mirror of
https://github.com/rkd77/elinks.git
synced 2025-05-18 00:48:57 -04:00
Add tests for more things like space handling and obscure formatting
This commit is contained in:
parent
beb8337fc5
commit
958a4a1b51
@ -44,6 +44,17 @@ element: html
|
|||||||
element: p
|
element: p
|
||||||
#text: Hello World!'
|
#text: Hello World!'
|
||||||
|
|
||||||
|
test_output_equals \
|
||||||
|
'Parse elements.' \
|
||||||
|
'<root><child attr="value" /><child2></><child3 >a</></root>' \
|
||||||
|
'
|
||||||
|
element: root
|
||||||
|
element: child
|
||||||
|
attribute: attr -> value
|
||||||
|
element: child2
|
||||||
|
element: child3
|
||||||
|
#text: a'
|
||||||
|
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse an enclosed comment.' \
|
'Parse an enclosed comment.' \
|
||||||
'<root><!-- Hello World! --></root>' \
|
'<root><!-- Hello World! --></root>' \
|
||||||
@ -68,26 +79,45 @@ element: root
|
|||||||
attribute: name -> value with &foo; <stuff'
|
attribute: name -> value with &foo; <stuff'
|
||||||
|
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse entity references.' \
|
'Parse attributes with garbage.' \
|
||||||
'<root>&...*...&...copy;...&;...&#;' \
|
"<root a=b c='d' e'f' g= h i = j k =></root>" \
|
||||||
'
|
'
|
||||||
element: root
|
element: root
|
||||||
entity-reference: amp
|
attribute: a -> b
|
||||||
#text: ...
|
attribute: c -> d
|
||||||
entity-reference: #42
|
attribute: g -> h
|
||||||
#text: ...
|
attribute: i -> j
|
||||||
entity-reference: ...copy
|
attribute: k -> '
|
||||||
#text: ...
|
|
||||||
#text: &;
|
test_output_equals \
|
||||||
#text: ...
|
'Parse entity references.' \
|
||||||
entity-reference: #'
|
'&-*' \
|
||||||
|
'
|
||||||
|
entity-reference: amp
|
||||||
|
#text: -
|
||||||
|
entity-reference: #42'
|
||||||
|
|
||||||
|
# Just how these should be gracefully handled is not clear to me.
|
||||||
|
test_output_equals \
|
||||||
|
'Parse badly formatted entity references.' \
|
||||||
|
'& m33p;-&.:-copy;-&;-&#;-&#xx;' \
|
||||||
|
'
|
||||||
|
#text: & m33p;
|
||||||
|
#text: -
|
||||||
|
entity-reference: .:-copy
|
||||||
|
#text: -
|
||||||
|
#text: &;
|
||||||
|
#text: -
|
||||||
|
entity-reference: #
|
||||||
|
#text: -
|
||||||
|
entity-reference: #xx'
|
||||||
|
|
||||||
# Test <?>
|
# Test <?>
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse processing instructions.' \
|
'Parse processing instructions.' \
|
||||||
'<?xml encoding="UTF8"?>
|
'<?xml encoding="UTF8"?>
|
||||||
...
|
...
|
||||||
<?ecmascript
|
<?ecmascript
|
||||||
var val=2;
|
var val=2;
|
||||||
?>' \
|
?>' \
|
||||||
'
|
'
|
||||||
@ -96,4 +126,19 @@ 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 \
|
||||||
|
'Skip spaces not inside text.' \
|
||||||
|
'<
|
||||||
|
root
|
||||||
|
ns:attr
|
||||||
|
=
|
||||||
|
"value"
|
||||||
|
><?
|
||||||
|
target
|
||||||
|
data?>< / root >' \
|
||||||
|
'
|
||||||
|
element: root
|
||||||
|
attribute: ns:attr -> value
|
||||||
|
proc-instruction: target -> data'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user