v2 / vlib / encoding / xml / test / local / 20_bom_file / bom_test.v
17 lines · 13 sloc · 407 bytes · 5f08d45c7c3242597fb439296b28c48ddbf3aca0
Raw
1module main
2
3import os
4import encoding.xml
5
6fn test_valid_parsing() {
7 // We use a .bin file to avoid stripping the BOM from the XML file
8 path := os.join_path(os.dir(@FILE), 'workbook.bin')
9
10 doc := xml.XMLDocument.from_file(path) or {
11 assert false, 'Failed to parse workbook.bin'
12 exit(1)
13 }
14
15 sheets := doc.get_elements_by_tag('sheet')
16 assert sheets.len == 1, 'Expected 1 sheet, got ${sheets.len}'
17}
18