nswrap/ast/constant_expr_test.go

65 lines
1.7 KiB
Go

package ast
import (
"testing"
)
func TestConstantExpr(t *testing.T) {
nodes := map[string]testNode{
`0x7f9bf3033240 <col:11, col:25> 'int'`: testNode{&ConstantExpr{
Addr: 0x7f9bf3033240,
Pos: NewPositionFromString("col:11, col:25"),
Type: "int",
ChildNodes: []Node{},
},
0x7f9bf3033240,
NewPositionFromString("col:11, col:25"),
[]Node{},
},
`0x7f9bf3035c20 <line:7:4, col:64> 'int'`: testNode{&ConstantExpr{
Addr: 0x7f9bf3035c20,
Pos: NewPositionFromString("line:7:4, col:64"),
Type: "int",
ChildNodes: []Node{},
},
0x7f9bf3035c20,
NewPositionFromString("line:7:4, col:64"),
[]Node{},
},
`0x7f9bf3035c20 <line:7:4, col:64> 'unsigned int'`: testNode{&ConstantExpr{
Addr: 0x7f9bf3035c20,
Pos: NewPositionFromString("line:7:4, col:64"),
Type: "unsigned int",
ChildNodes: []Node{},
},
0x7f9bf3035c20,
NewPositionFromString("line:7:4, col:64"),
[]Node{},
},
`0x7f9bf3035c20 <line:7:4, col:64> 'NSModalResponse':'long' Int: 1`: testNode{&ConstantExpr{
Addr: 0x7f9bf3035c20,
Pos: NewPositionFromString("line:7:4, col:64"),
Type: "NSModalResponse",
Type2: "long",
ChildNodes: []Node{},
},
0x7f9bf3035c20,
NewPositionFromString("line:7:4, col:64"),
[]Node{},
},
`0x7f9bf3035c20 <line:7:4, col:64> 'NSModalResponse':'unsigned long' Int: 1`: testNode{&ConstantExpr{
Addr: 0x7f9bf3035c20,
Pos: NewPositionFromString("line:7:4, col:64"),
Type: "NSModalResponse",
Type2: "unsigned long",
ChildNodes: []Node{},
},
0x7f9bf3035c20,
NewPositionFromString("line:7:4, col:64"),
[]Node{},
},
}
runNodeTests(t, nodes)
}