php-parser/scanner/token_test.go

35 lines
511 B
Go

package scanner_test
import (
"reflect"
"testing"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/scanner"
)
func TestToken(t *testing.T) {
tkn := &scanner.Token{
Value: `foo`,
StartLine: 1,
EndLine: 1,
StartPos: 0,
EndPos: 3,
}
c := []meta.Meta{
meta.NewComment("test comment", nil),
}
tkn.Meta = c
if !reflect.DeepEqual(tkn.Meta, c) {
t.Errorf("comments are not equal\n")
}
if tkn.String() != `foo` {
t.Errorf("token value is not equal\n")
}
}