From da6d57a28037fcc062611b55e78a5f80a9a4d8bb Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Sun, 22 May 2022 00:05:05 +0200 Subject: [PATCH] Explicit test for bug that caused all this trouble --- src/tests/interpreter.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tests/interpreter.cc b/src/tests/interpreter.cc index 1d9e7ff..eaa238d 100644 --- a/src/tests/interpreter.cc +++ b/src/tests/interpreter.cc @@ -74,5 +74,11 @@ suite intepreter_test = [] { expect(eq(result.error().type, errors::Not_Callable)); } }; + + // Added to explicitly test against bug that was in old implementation of enviroments. + // Previously this test would segfault + should("allow assigning result of function calls to a variable") = [] { + evaluates_to(Value::number(Number(42)), "var x = [i|i] 42; x"); + }; }; };