Skip to content

Commit

Permalink
updated function and anonymous function decl tests to reflect the pre…
Browse files Browse the repository at this point in the history
…vious changes
  • Loading branch information
mkarten committed Oct 3, 2024
1 parent 2e8598d commit eaa97fa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions parser/Parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,13 @@ func TestParser_ParseAnonymousFunctionExpr(t *testing.T) {
t.Errorf("ParseAnonymousFunctionExpr() raised an error when it should not")
}
ok = false
// function declaration with structs as parameters and field access in the body
resetWithTokens(&par, lexer.Lexer("function(a : Test, b : Test)( string) {return a.test + b.test;}"))
par.VarTypes["Test"] = "struct"
par.ParseAnonymousFunctionExpr()
if ok {
t.Errorf("ParseAnonymousFunctionExpr() raised an error when it should not")
}

e.RestoreExit()
}
Expand Down Expand Up @@ -1645,6 +1652,13 @@ func TestParser_ParseFunctionDecl(t *testing.T) {
t.Errorf("ParseFunctionDecl() did not raise the missing left parenthesis error")
}
ok = false
// function declaration with structs as parameters and field access in the body
resetWithTokens(&par, lexer.Lexer("function test(a : Test, b : Test)( string) {return a.test + b.test;}"))
par.VarTypes["Test"] = "struct"
par.ParseFunctionDecl()
if ok {
t.Errorf("ParseFunctionDecl() raised an error when it should not")
}

e.RestoreExit()
}
Expand Down

0 comments on commit eaa97fa

Please sign in to comment.