Lexer unit test now prints out resulting error

This commit is contained in:
Sasha Koshka 2022-08-10 13:03:48 -04:00
parent cf04dfd600
commit 9f8b48161a
2 changed files with 3 additions and 1 deletions

View File

@ -13,7 +13,7 @@ type LexingOperation struct {
// Tokenize converts a file into a slice of tokens (lexemes).
func Tokenize (file *file.File) (tokens []Token, err error) {
lexer := LexingOperation { file: file }
err = lexer.tokenize()
err = lexer.tokenize()
tokens = lexer.tokens
// if the lexing operation returned io.EOF, nothing went wrong so we

View File

@ -13,6 +13,8 @@ func TestTokenizeAll (test *testing.T) {
}
tokens, err := Tokenize(file)
test.Log("resulting error:")
test.Log(err.Error())
if err == nil {
test.Log("Tokenize() should have returned an error")
test.Fail()