xgo/parser/parser_char_test.go

25 lines
377 B
Go
Raw Normal View History

2019-01-10 13:45:20 +03:00
package parser_test
import (
"testing"
"github.com/d5/tengo/ast"
)
func TestChar(t *testing.T) {
expect(t, `'A'`, func(p pfn) []ast.Stmt {
return stmts(
exprStmt(
charLit('A', 1)))
})
expect(t, `'九'`, func(p pfn) []ast.Stmt {
return stmts(
exprStmt(
charLit('九', 1)))
})
expectError(t, `''`)
expectError(t, `'AB'`)
expectError(t, `'A九'`)
}