-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(c14n): add canonicalization functionality #37
Conversation
xmlua/c14n.lua
Outdated
local ffi = require("ffi") | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! I didn't know that libxml2 provides the c14n API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kou thx for the review. Updated the PR. please have another look.
250e088
to
e57e61d
Compare
For the CI failures, not sure what happened. Since the failures are unrelated to this PR, it reminds me of the ffi-reloading issue. The test frameworks tend to isolate tests, by clearing the environment and run the next test clean. However the LuaJIT ffi is not suited for that and will occasionally segfault if you do. |
I reworked your review comments one-by-one, a commit per comment. Just the last commit (merge into document.lua) is a big one that obfuscates all other changes. So probably best to review the changes on a per commit basis. |
Could you add some tests for |
yes it should, but my priorities are shifting, so might take a while. |
basic test added |
@kou any update on this? |
test/test-document-c14n.lua
Outdated
-- From: https://www.w3.org/2008/xmlsec/Drafts/c14n-20/test-cases/Overview.src.html | ||
|
||
function TestDocumentC14N.test_PIs_Comments_and_Outside_of_Document_Element() | ||
-- https://www.w3.org/2008/xmlsec/Drafts/c14n-20/test-cases/files/inC14N1.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, we don't need to test C14N behaviors implemented in libxml2. Because they must be tested in libxml2.
We only need to test our API. For example, document:canonicalize(function)
case, document:canonicalize(nodes)
case, document:canonicalize(..., options)
case and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, all I did was just grab some of them to verify it works as intended.
This tests with and without "with_comments" probably also needs a test with the prefix list
Sorry for my late response... How about the followings to proceed this?
(We can write documents for this later.) |
Done
if you handle item 2, then 3 is also yours to handle. So please go ahead. |
I've fixed test failures on macOS on master and rebased on master. I've added tests. I also added some changes:
I'll merge this if you don't object these changes. |
Lgtm! |
Merged! Should we release the current master as a new version? Or should we release a new version after #40? |
no real opinion here. Since that would add a feature, it can be done at any later time as well. |
OK. I'll release a new version before #40. |
Released. |
GitHub: fix GH-36