Lexer unit test now prints out resulting error
This commit is contained in:
parent
cf04dfd600
commit
9f8b48161a
@ -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
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user