v / vlib / encoding / xml / test / local / 07_mixed_contents / mixed_test.v
33 lines · 30 sloc · 651 bytes · c51d30bf5309653c6b573ec815268e69a78ea8cc
Raw
1import os
2import encoding.xml
3
4fn test_valid_parsing() ! {
5 path := os.join_path(os.dir(@FILE), 'mixed.xml')
6
7 expected := xml.XMLDocument{
8 root: xml.XMLNode{
9 name: 'letter'
10 children: [
11 'Dear Mr.',
12 xml.XMLNode{
13 name: 'name'
14 children: ['John Smith']
15 },
16 '.\n Your order',
17 xml.XMLNode{
18 name: 'orderid'
19 children: ['1032']
20 },
21 'will be shipped on',
22 xml.XMLNode{
23 name: 'shipdate'
24 children: ['2001-07-13']
25 },
26 '.',
27 ]
28 }
29 }
30 actual := xml.XMLDocument.from_file(path)!
31
32 assert expected == actual, 'Parsed XML document should be equal to expected XML document'
33}
34