forked from clbanning/mxj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xml3_test.go
47 lines (42 loc) · 1001 Bytes
/
xml3_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// xml3_test.go - patch tests
package mxj
import (
"fmt"
"testing"
)
func TestXml3(t *testing.T) {
fmt.Println("\n------------ xml3_test.go")
}
// for: https://github.com/clbanning/mxj/pull/26
func TestOnlyAttributes(t *testing.T) {
fmt.Println("========== TestOnlyAttributes")
dom, err := NewMapXml([]byte(`
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
<empty/>
</memballoon>)`))
if err != nil {
t.Fatal(err)
}
xml, err := dom.XmlIndent("", " ")
if err != nil {
t.Fatal(err)
}
fmt.Println(string(xml))
}
func TestOnlyAttributesSeq(t *testing.T) {
fmt.Println("========== TestOnlyAttributesSeq")
dom, err := NewMapXmlSeq([]byte(`
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
<empty/>
</memballoon>)`))
if err != nil {
t.Fatal(err)
}
xml, err := dom.XmlSeqIndent("", " ")
if err != nil {
t.Fatal(err)
}
fmt.Println(string(xml))
}