go/scanner: add missing BOM test

R=r
CC=golang-dev
https://golang.org/cl/6498106
This commit is contained in:
Robert Griesemer 2012-09-07 16:28:15 -07:00
parent 4be9b83eb6
commit 2a391f467d
1 changed files with 2 additions and 0 deletions

View File

@ -346,6 +346,7 @@ var lines = []string{
// # indicates a semicolon present in the source
// $ indicates an automatically inserted semicolon
"",
"\ufeff#;", // first BOM is ignored
"#;",
"foo$\n",
"123$\n",
@ -694,6 +695,7 @@ var errors = []struct {
{"0X", token.INT, 0, "illegal hexadecimal number"},
{"\"abc\x00def\"", token.STRING, 4, "illegal character NUL"},
{"\"abc\x80def\"", token.STRING, 4, "illegal UTF-8 encoding"},
{"\ufeff\ufeff", token.ILLEGAL, 3, "illegal character U+FEFF"}, // only first BOM is ignored
}
func TestScanErrors(t *testing.T) {