Skip to content

Commit

Permalink
asm/lexer: Add test case for operators and delimiters. Updates #8.
Browse files Browse the repository at this point in the history
  • Loading branch information
mewmew committed Jan 15, 2015
1 parent 907bcba commit 03be54c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions asm/lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ func TestParse(t *testing.T) {
{Kind: token.EOF, Line: 1, Col: 25},
},
},
// i=3
{
input: "...=,*[]{}()<>!",
want: []token.Token{
{Kind: token.Ellipsis, Val: "...", Line: 1, Col: 1},
{Kind: token.Equal, Val: "=", Line: 1, Col: 4},
{Kind: token.Comma, Val: ",", Line: 1, Col: 5},
{Kind: token.Star, Val: "*", Line: 1, Col: 6},
{Kind: token.Lbrack, Val: "[", Line: 1, Col: 7},
{Kind: token.Rbrack, Val: "]", Line: 1, Col: 8},
{Kind: token.Lbrace, Val: "{", Line: 1, Col: 9},
{Kind: token.Rbrace, Val: "}", Line: 1, Col: 10},
{Kind: token.Lparen, Val: "(", Line: 1, Col: 11},
{Kind: token.Rparen, Val: ")", Line: 1, Col: 12},
{Kind: token.Less, Val: "<", Line: 1, Col: 13},
{Kind: token.Greater, Val: ">", Line: 1, Col: 14},
{Kind: token.Exclaim, Val: "!", Line: 1, Col: 15},
{Kind: token.EOF, Line: 1, Col: 16},
},
},
}
for i, g := range golden {
got := Parse(g.input)
Expand Down

0 comments on commit 03be54c

Please sign in to comment.