2019-04-09 11:52:21 -04:00
|
|
|
package ast
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFormatAttr(t *testing.T) {
|
2019-06-04 00:14:04 -04:00
|
|
|
nodes := map[string]testNode{
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7fcc8d8ecee8 <col:6> Implicit printf 2 3`: testNode{&FormatAttr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x7fcc8d8ecee8,
|
|
|
|
Pos: NewPositionFromString("col:6"),
|
|
|
|
Implicit: true,
|
|
|
|
Inherited: false,
|
|
|
|
FunctionName: "printf",
|
|
|
|
Unknown1: 2,
|
|
|
|
Unknown2: 3,
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7fcc8d8ecee8,
|
|
|
|
NewPositionFromString("col:6"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7fcc8d8ecff8 </usr/include/sys/cdefs.h:351:18, col:61> printf 2 3`: testNode{&FormatAttr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x7fcc8d8ecff8,
|
|
|
|
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"),
|
|
|
|
Implicit: false,
|
|
|
|
Inherited: false,
|
|
|
|
FunctionName: "printf",
|
|
|
|
Unknown1: 2,
|
|
|
|
Unknown2: 3,
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7fcc8d8ecff8,
|
|
|
|
NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x273b4d0 <line:357:12> Inherited printf 2 3`: testNode{&FormatAttr{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x273b4d0,
|
|
|
|
Pos: NewPositionFromString("line:357:12"),
|
|
|
|
Implicit: false,
|
|
|
|
Inherited: true,
|
|
|
|
FunctionName: "printf",
|
|
|
|
Unknown1: 2,
|
|
|
|
Unknown2: 3,
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x273b4d0,
|
|
|
|
NewPositionFromString("line:357:12"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-04-09 11:52:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
runNodeTests(t, nodes)
|
|
|
|
}
|