mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
More <?xml and comment tests, fix an off-by-one error for comments skipping
This commit is contained in:
parent
bd877570d2
commit
76a524ddf6
@ -178,7 +178,7 @@ skip_comment(struct dom_scanner *scanner, unsigned char **string)
|
|||||||
unsigned char *pos = *string;
|
unsigned char *pos = *string;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
|
||||||
for (; pos < scanner->end - 3; pos++)
|
for (; pos < scanner->end - 2; pos++)
|
||||||
if (pos[0] == '-' && pos[1] == '-' && pos[2] == '>') {
|
if (pos[0] == '-' && pos[1] == '-' && pos[2] == '>') {
|
||||||
length = pos - *string;
|
length = pos - *string;
|
||||||
pos += 3;
|
pos += 3;
|
||||||
|
@ -62,6 +62,20 @@ test_output_equals \
|
|||||||
element: root
|
element: root
|
||||||
#comment: Hello World! '
|
#comment: Hello World! '
|
||||||
|
|
||||||
|
test_output_equals \
|
||||||
|
'Parse comment combinations.' \
|
||||||
|
'<root><!-- <!-- -- > --><!----></root>' \
|
||||||
|
'
|
||||||
|
element: root
|
||||||
|
#comment: <!-- -- >
|
||||||
|
#comment: '
|
||||||
|
|
||||||
|
test_output_equals \
|
||||||
|
'Parse comment combinations.' \
|
||||||
|
'<!--foo-->' \
|
||||||
|
'
|
||||||
|
#comment: foo'
|
||||||
|
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse an enclosed CDATA section.' \
|
'Parse an enclosed CDATA section.' \
|
||||||
'<root><![CDATA[...] ]>...]]></root>' \
|
'<root><![CDATA[...] ]>...]]></root>' \
|
||||||
@ -135,6 +149,14 @@ proc-instruction: xml -> encoding="UTF8"
|
|||||||
#text: \n...\n
|
#text: \n...\n
|
||||||
proc-instruction: ecmascript -> var val=2;\n'
|
proc-instruction: ecmascript -> var val=2;\n'
|
||||||
|
|
||||||
|
test_output_equals \
|
||||||
|
'Parse XML processing instructions.' \
|
||||||
|
'<?xml version="1.0" />?><?xml />-' \
|
||||||
|
'
|
||||||
|
proc-instruction: xml -> version="1.0" />
|
||||||
|
attribute: version -> 1.0
|
||||||
|
proc-instruction: xml -> /'
|
||||||
|
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse exotic processing instructions.' \
|
'Parse exotic processing instructions.' \
|
||||||
'<?xml ?+>+?>-?>-<?js?>-<??>-' \
|
'<?xml ?+>+?>-?>-<?js?>-<??>-' \
|
||||||
|
Loading…
Reference in New Issue
Block a user