aboutsummaryrefslogtreecommitdiff
path: root/test/test_jsinterp.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_jsinterp.py')
-rw-r--r--test/test_jsinterp.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index ed3ca61c4..055dcf42f 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -462,6 +462,16 @@ class TestJSInterpreter(unittest.TestCase):
]:
assert js_number_to_string(test, radix) == expected
+ def test_extract_function(self):
+ jsi = JSInterpreter('function a(b) { return b + 1; }')
+ func = jsi.extract_function('a')
+ self.assertEqual(func([2]), 3)
+
+ def test_extract_function_with_global_stack(self):
+ jsi = JSInterpreter('function c(d) { return d + e + f + g; }')
+ func = jsi.extract_function('c', {'e': 10}, {'f': 100, 'g': 1000})
+ self.assertEqual(func([1]), 1111)
+
if __name__ == '__main__':
unittest.main()