mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
xml: update entity parse test (#21190)
This commit is contained in:
parent
254250d375
commit
a7d68cbc2d
2 changed files with 11 additions and 33 deletions
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE body [
|
||||
<!ENTITY warning "Warning: Something bad happened... please refresh and try again.">
|
||||
]>
|
||||
<body>
|
||||
<message>
|
||||
Warning: Something bad happened... please refresh and try again.
|
||||
</message>
|
||||
</body>
|
|
@ -4,38 +4,7 @@ import os
|
|||
import encoding.xml
|
||||
|
||||
fn test_valid_parsing() {
|
||||
path := os.join_path(os.dir(@FILE), 'entity.xml')
|
||||
|
||||
mut reverse_entities := xml.default_entities_reverse.clone()
|
||||
reverse_entities['Warning: Something bad happened... please refresh and try again.'] = 'warning'
|
||||
|
||||
expected := xml.XMLDocument{
|
||||
parsed_reverse_entities: reverse_entities
|
||||
doctype: xml.DocumentType{
|
||||
name: 'body'
|
||||
dtd: xml.DocumentTypeDefinition{
|
||||
name: ''
|
||||
list: [
|
||||
xml.DTDEntity{
|
||||
name: 'warning'
|
||||
value: 'Warning: Something bad happened... please refresh and try again.'
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
root: xml.XMLNode{
|
||||
name: 'body'
|
||||
children: [
|
||||
xml.XMLNode{
|
||||
name: 'message'
|
||||
children: [
|
||||
'Warning: Something bad happened... please refresh and try again.',
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
actual := xml.XMLDocument.from_file(path)!.validate()!
|
||||
|
||||
expected := xml.XMLDocument.from_file(os.join_path(os.dir(@FILE), 'entity.xml'))!.validate()!
|
||||
actual := xml.XMLDocument.from_file(os.join_path(os.dir(@FILE), 'entity_expected.xml'))!.validate()!
|
||||
assert expected == actual, 'Parsed XML document should be equal to expected XML document'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue