diff options
Diffstat (limited to 'pkg/lang/scanner/scanner_test.go')
| -rw-r--r-- | pkg/lang/scanner/scanner_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/lang/scanner/scanner_test.go b/pkg/lang/scanner/scanner_test.go index cc19f8f..3af7fa4 100644 --- a/pkg/lang/scanner/scanner_test.go +++ b/pkg/lang/scanner/scanner_test.go @@ -97,3 +97,24 @@ func TestTightIdent(t *testing.T) { require.Equal(t, expected, tokens) } + +func TestTightNumber(t *testing.T) { + source := `1+2+3` + + s := scanner.New(strings.NewReader(source)) + + tokens, err := s.Scan() + require.NoError(t, err) + + expected := []token.Token{ + token.New(token.Int, token.NewLoc(0, 0), uint64(1)), + token.Simple(token.Plus, token.NewLoc(0, 1)), + token.New(token.Int, token.NewLoc(0, 2), uint64(2)), + token.Simple(token.Plus, token.NewLoc(0, 3)), + token.New(token.Int, token.NewLoc(0, 4), uint64(3)), + token.Simple(token.EOF, token.NewLoc(0, 5)), + } + + require.Equal(t, expected, tokens) +} + |
