v2 / vlib / encoding / xml / test / local / 11_cdata_content / cdata_test.v
29 lines · 25 sloc · 574 bytes · c51d30bf5309653c6b573ec815268e69a78ea8cc
Raw
1module main
2
3import os
4import encoding.xml
5
6fn test_valid_parsing() {
7 path := os.join_path(os.dir(@FILE), 'cdata.xml')
8
9 expected := xml.XMLDocument{
10 root: xml.XMLNode{
11 name: 'sample'
12 children: [
13 xml.XMLNode{
14 name: 'html'
15 children: ['This is <b>bold</b>']
16 },
17 xml.XMLNode{
18 name: 'html'
19 children: [xml.XMLCData{
20 text: 'This is <b>bold</b>'
21 }]
22 },
23 ]
24 }
25 }
26 actual := xml.XMLDocument.from_file(path)!
27
28 assert expected == actual, 'Parsed XML document should be equal to expected XML document'
29}
30