-
Notifications
You must be signed in to change notification settings - Fork 113
/
seqnum_test.go
52 lines (43 loc) · 869 Bytes
/
seqnum_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
48
49
50
51
52
// seqnum.go
package mxj
import (
"fmt"
"testing"
)
var seqdata1 = []byte(`
<Obj c="la" x="dee" h="da">
<IntObj id="3"/>
<IntObj1 id="1"/>
<IntObj id="2"/>
</Obj>`)
var seqdata2 = []byte(`
<Obj c="la" x="dee" h="da">
<IntObj id="3"/>
<NewObj>
<id>1</id>
<StringObj>hello</StringObj>
<BoolObj>true</BoolObj>
</NewObj>
<IntObj id="2"/>
</Obj>`)
func TestSeqNumHeader(t *testing.T) {
fmt.Println("\n---------------- seqnum_test.go ...")
}
func TestSeqNum(t *testing.T) {
IncludeTagSeqNum(true)
m, err := NewMapXml(seqdata1, Cast)
if err != nil {
t.Fatal(err)
}
fmt.Printf("m1: %#v\n", m)
j, _ := m.JsonIndent("", " ")
fmt.Println(string(j))
m, err = NewMapXml(seqdata2, Cast)
if err != nil {
t.Fatal(err)
}
fmt.Printf("m2: %#v\n", m)
j, _ = m.JsonIndent("", " ")
fmt.Println(string(j))
IncludeTagSeqNum(false)
}