nswrap/ast/non_null_attr_test.go

111 lines
2.6 KiB
Go
Raw Normal View History

2019-04-09 11:52:21 -04:00
package ast
import (
"testing"
)
func TestNonNullAttr(t *testing.T) {
2019-06-04 00:14:04 -04:00
nodes := map[string]testNode{
`0x7fa1488273b0 <line:7:4, line:11:4> 1`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x7fa1488273b0,
Pos: NewPositionFromString("line:7:4, line:11:4"),
Inherited: false,
A: 1,
B: 0,
C: 0,
D: 0,
ChildNodes: []Node{},
},
0x7fa1488273b0,
NewPositionFromString("line:7:4, line:11:4"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x2cce280 </sys/cdefs.h:286:44, /bits/mathcalls.h:115:69> 1`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x2cce280,
Pos: NewPositionFromString("/sys/cdefs.h:286:44, /bits/mathcalls.h:115:69"),
Inherited: false,
A: 1,
B: 0,
C: 0,
D: 0,
ChildNodes: []Node{},
},
0x2cce280,
NewPositionFromString("/sys/cdefs.h:286:44, /bits/mathcalls.h:115:69"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x201ede0 <line:145:79, col:93> 0`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x201ede0,
Pos: NewPositionFromString("line:145:79, col:93"),
Inherited: false,
A: 0,
B: 0,
C: 0,
D: 0,
ChildNodes: []Node{},
},
0x201ede0,
NewPositionFromString("line:145:79, col:93"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x1b89b20 <col:76, col:93> 2 3`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x1b89b20,
Pos: NewPositionFromString("col:76, col:93"),
Inherited: false,
A: 2,
B: 3,
C: 0,
D: 0,
ChildNodes: []Node{},
},
0x1b89b20,
NewPositionFromString("col:76, col:93"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x55f0219e20d0 <line:717:22, col:42> 0 1 4`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x55f0219e20d0,
Pos: NewPositionFromString("line:717:22, col:42"),
Inherited: false,
A: 0,
B: 1,
C: 4,
D: 0,
ChildNodes: []Node{},
},
0x55f0219e20d0,
NewPositionFromString("line:717:22, col:42"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x248ea60 <line:155:26, col:49> 0 1 2 4`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x248ea60,
Pos: NewPositionFromString("line:155:26, col:49"),
Inherited: false,
A: 0,
B: 1,
C: 2,
D: 4,
ChildNodes: []Node{},
},
0x248ea60,
NewPositionFromString("line:155:26, col:49"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
`0x39cf2b0 <col:53> Inherited 0 1`: testNode{&NonNullAttr{
2019-04-09 11:52:21 -04:00
Addr: 0x39cf2b0,
Pos: NewPositionFromString("col:53"),
Inherited: true,
A: 0,
B: 1,
C: 0,
D: 0,
ChildNodes: []Node{},
},
0x39cf2b0,
NewPositionFromString("col:53"),
[]Node{},
2019-06-04 00:14:04 -04:00
},
2019-04-09 11:52:21 -04:00
}
runNodeTests(t, nodes)
}