This repository has been archived on 2024-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
arf/lexer/lexer_test.go

34 lines
587 B
Go
Raw Normal View History

2022-08-10 09:28:29 -06:00
package lexer
import "testing"
import "github.com/sashakoshka/arf/file"
func TestTokenizeAll (test *testing.T) {
file, err := file.Open("tests/parser/all")
if err != nil {
test.Log(err)
test.Fail()
}
tokens, err := Tokenize(file)
if err != nil {
test.Log(err)
test.Fail()
}
correct := []Token {
Token { kind: TokenKindSeparator, },
}
if len(tokens) != len(correct) {
test.Log("lexed", tokens, "tokens, want", correct)
}
for index, token := range tokens {
if !token.Equals(correct[index]) {
test.Log("token", index, "not equal")
test.Fail()
}
}
}