From 6111bda1e15d9a3e5dbeeee431126f65be1b5eaa Mon Sep 17 00:00:00 2001 From: Aymeric Wibo Date: Tue, 29 Oct 2024 22:35:30 +0100 Subject: [PATCH] tests: Regression test for evaluating call arguments before context switch --- tests/call_arg_eval_context.fl | 9 +++++++++ tests/call_arg_eval_context_helper.fl | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 tests/call_arg_eval_context.fl create mode 100644 tests/call_arg_eval_context_helper.fl diff --git a/tests/call_arg_eval_context.fl b/tests/call_arg_eval_context.fl new file mode 100644 index 0000000..3cf2ce1 --- /dev/null +++ b/tests/call_arg_eval_context.fl @@ -0,0 +1,9 @@ +# Regression test. +# When calling a function that is defined in a different source file, the context's source could be switched to the source file of the function being called before the argument expressions are evaluated. +# This would cause these evaluations to use the wrong source file. + +# TODO rename this + +import .tests.call_arg_eval_context_helper + +assert function("zonnebloemgranen") == "zonnebloemgranen" diff --git a/tests/call_arg_eval_context_helper.fl b/tests/call_arg_eval_context_helper.fl new file mode 100644 index 0000000..b97f5a9 --- /dev/null +++ b/tests/call_arg_eval_context_helper.fl @@ -0,0 +1,3 @@ +fn function(x) { + return x +}