test scalar string

This commit is contained in:
vadim
2017-12-04 12:40:36 +02:00
parent 1c1926516e
commit 7c3d593097
10 changed files with 549 additions and 549 deletions

View File

@@ -0,0 +1,25 @@
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")
}
}