1
0
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:
Jonas Fonseca 2005-12-29 22:26:39 +01:00 committed by Jonas Fonseca
parent bd877570d2
commit 76a524ddf6
2 changed files with 23 additions and 1 deletions

View File

@ -178,7 +178,7 @@ skip_comment(struct dom_scanner *scanner, unsigned char **string)
unsigned char *pos = *string;
int length = 0;
for (; pos < scanner->end - 3; pos++)
for (; pos < scanner->end - 2; pos++)
if (pos[0] == '-' && pos[1] == '-' && pos[2] == '>') {
length = pos - *string;
pos += 3;

View File

@ -62,6 +62,20 @@ test_output_equals \
element: root
#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 \
'Parse an enclosed CDATA section.' \
'<root><![CDATA[...] ]>...]]></root>' \
@ -135,6 +149,14 @@ proc-instruction: xml -> encoding="UTF8"
#text: \n...\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 \
'Parse exotic processing instructions.' \
'<?xml ?+>+?>-?>-<?js?>-<??>-' \