Skip to content

Commit

Permalink
parser/lexer: add tests for special identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
filips committed Jun 10, 2024
1 parent ebb78ea commit a14eb3c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions parser/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,21 @@ Second line \
token.RIGHT_BRACKET, "", 6,
)

// Identifier from Unicode Nl
test("\u16ee",
token.IDENTIFIER, "ᛮ", 1,
)

// Identifier from Unicode Other_ID_Start
test("\u212e",
token.IDENTIFIER, "℮", 1,
)

// Using char from ID_Continue after valid start char
test("a\u0300",
token.IDENTIFIER, "à", 1,
)

// ILLEGAL

test(`3ea`,
Expand Down Expand Up @@ -383,5 +398,16 @@ Second line \
token.STRING, "\"\\x0G\"", 1,
token.EOF, "", 7,
)

// Starting identifier with ID_Continue char from Nm
test("\u0300",
token.ILLEGAL,
)

// Starting identifier with Pattern_Syntax
test("'",
token.ILLEGAL,
)

Check failure on line 411 in parser/lexer_test.go

View workflow job for this annotation

GitHub Actions / go-test-lint (1.21, v1.57.2, ubuntu-latest)

File is not `gofumpt`-ed (gofumpt)

Check failure on line 411 in parser/lexer_test.go

View workflow job for this annotation

GitHub Actions / go-test-lint (1.22, v1.57.2, ubuntu-latest)

File is not `gofumpt`-ed (gofumpt)
})

Check failure on line 412 in parser/lexer_test.go

View workflow job for this annotation

GitHub Actions / go-test-lint (1.21, v1.57.2, ubuntu-latest)

unnecessary trailing newline (whitespace)

Check failure on line 412 in parser/lexer_test.go

View workflow job for this annotation

GitHub Actions / go-test-lint (1.21, v1.57.2, ubuntu-latest)

unnecessary trailing newline (whitespace)

Check failure on line 412 in parser/lexer_test.go

View workflow job for this annotation

GitHub Actions / go-test-lint (1.22, v1.57.2, ubuntu-latest)

unnecessary trailing newline (whitespace)

Check failure on line 412 in parser/lexer_test.go

View workflow job for this annotation

GitHub Actions / go-test-lint (1.22, v1.57.2, ubuntu-latest)

unnecessary trailing newline (whitespace)
}

0 comments on commit a14eb3c

Please sign in to comment.