2019-04-09 11:52:21 -04:00
|
|
|
package ast
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStringLiteral(t *testing.T) {
|
2019-06-04 00:14:04 -04:00
|
|
|
nodes := map[string]testNode{
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x7fe16f0b4d58 <col:11> 'char [45]' lvalue "Number of command line arguments passed: %d\n"`: testNode{&StringLiteral{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x7fe16f0b4d58,
|
|
|
|
Pos: NewPositionFromString("col:11"),
|
|
|
|
Type: "char [45]",
|
|
|
|
Lvalue: true,
|
|
|
|
Value: "Number of command line arguments passed: %d\n",
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x7fe16f0b4d58,
|
|
|
|
NewPositionFromString("col:11"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
`0x22ac548 <col:14> 'char [14]' lvalue "x\vx\000xxx\axx\tx\n"`: testNode{&StringLiteral{
|
2019-04-09 11:52:21 -04:00
|
|
|
Addr: 0x22ac548,
|
|
|
|
Pos: NewPositionFromString("col:14"),
|
|
|
|
Type: "char [14]",
|
|
|
|
Lvalue: true,
|
|
|
|
Value: "x\vx\x00xxx\axx\tx\n",
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
},
|
2019-06-11 12:38:22 -04:00
|
|
|
0x22ac548,
|
|
|
|
NewPositionFromString("col:14"),
|
|
|
|
[]Node{},
|
2019-06-04 00:14:04 -04:00
|
|
|
},
|
2019-04-09 11:52:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
runNodeTests(t, nodes)
|
|
|
|
}
|