diff --git a/test/expressions.jl b/test/expressions.jl index 97b40fec..2645ded9 100644 --- a/test/expressions.jl +++ b/test/expressions.jl @@ -249,10 +249,10 @@ end anon = :((t, x) -> f(t, x, 1, d = 1)) @test InfiniteOpt._process_func_expr(error, anon) == (esc(anon), esc(:(t,x)), true) anon = :((t, x[1]) -> sin(t + x[1])) - @test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(0.5, 0.2) == sin(0.5 + 0.2) + @test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 0.5, 0.2) == sin(0.5 + 0.2) anon = :(t[i] -> t[i] + 3) - @test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(2) == 5 - # test errors + @test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 2) == 5 + # test errors @test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(t, d = 2))) @test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(x, t; d = 2))) @test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f >= 2))