php-parser/test/node_scalar_string_test.go
2017-12-04 12:40:36 +02:00

26 lines
532 B
Go

package test
import (
"bytes"
"reflect"
"testing"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/parser"
"github.com/z7zmey/php-parser/token"
)
func TestNewNodeScalarString(t *testing.T) {
src := `<? "test";`
strToken := token.NewToken([]byte("\"test\""), 1, 1)
strNode := node.NewNodeScalarString(strToken)
expected := node.SimpleNode("Statements").Append(strNode)
node := parser.Parse(bytes.NewBufferString(src), "test.php")
if !reflect.DeepEqual(expected, node) {
t.Error("Not equal")
}
}