xgo/parser/parser_char_test.go
2019-01-10 02:45:20 -08:00

24 lines
377 B
Go

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九'`)
}