-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: pay attention to comments and processing instructions in DTDs
Closes #19
- Loading branch information
Showing
2 changed files
with
163 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
"use strict"; | ||
|
||
const { test } = require("."); | ||
|
||
describe("dtd", () => { | ||
test({ | ||
name: "DTD with comment containing a quote", | ||
xml: `\ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE root [ | ||
<!-- I'm a test. --> | ||
]> | ||
<root/>`, | ||
expect: [ | ||
["text", "\n"], | ||
["doctype", ` root [ | ||
<!-- I'm a test. --> | ||
]`], | ||
["text", "\n"], | ||
["opentagstart", { name: "root", attributes: {} }], | ||
["opentag", { name: "root", attributes: {}, isSelfClosing: true }], | ||
["closetag", { name: "root", attributes: {}, isSelfClosing: true }], | ||
], | ||
}); | ||
|
||
test({ | ||
name: "DTD with processing instruction containing a quote", | ||
xml: `\ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE root [ | ||
<? I'm a test. ?> | ||
]> | ||
<root/>`, | ||
expect: [ | ||
["text", "\n"], | ||
["doctype", ` root [ | ||
<? I'm a test. ?> | ||
]`], | ||
["text", "\n"], | ||
["opentagstart", { name: "root", attributes: {} }], | ||
["opentag", { name: "root", attributes: {}, isSelfClosing: true }], | ||
["closetag", { name: "root", attributes: {}, isSelfClosing: true }], | ||
], | ||
}); | ||
|
||
test({ | ||
name: "DTD with ]> in a string", | ||
xml: `\ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE root [ | ||
<!NOTATION not1 SYSTEM "]>"> | ||
]> | ||
<root/>`, | ||
expect: [ | ||
["text", "\n"], | ||
["doctype", ` root [ | ||
<!NOTATION not1 SYSTEM "]>"> | ||
]`], | ||
["text", "\n"], | ||
["opentagstart", { name: "root", attributes: {} }], | ||
["opentag", { name: "root", attributes: {}, isSelfClosing: true }], | ||
["closetag", { name: "root", attributes: {}, isSelfClosing: true }], | ||
], | ||
}); | ||
}); |