From b7a14aed88176c6d21243e50d192688b489d71db Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Sun, 17 Sep 2023 05:12:10 +0100 Subject: [PATCH] Adds dynamic constant test case --- .../scr_testing_environment.gml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src-lts/scripts/scr_testing_environment/scr_testing_environment.gml b/src-lts/scripts/scr_testing_environment/scr_testing_environment.gml index 85574ea..54cb213 100644 --- a/src-lts/scripts/scr_testing_environment/scr_testing_environment.gml +++ b/src-lts/scripts/scr_testing_environment/scr_testing_environment.gml @@ -426,4 +426,18 @@ test_add_force(function () : Test( var _func = engine.compileGML(asg); var result = _func(); assertEq("good", result); +}); + +test_add_force(function () : Test( + "dynamic-constants" +) constructor { + var engine = new CatspeakEnvironment(); + engine.getInterface().exposeDynamicConstant("room_width", function() { return room_width; }); + engine.getInterface().exposeFunction("room_width_function", function() { return room_width; }); + var asg = engine.parseString(@' + return (room_width == room_width_function()); + '); + var _func = engine.compileGML(asg); + var result = _func(); + assertEq(true, result); }); \ No newline at end of file