From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- js/src/jit-test/tests/basic/testScriptCloning.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 js/src/jit-test/tests/basic/testScriptCloning.js (limited to 'js/src/jit-test/tests/basic/testScriptCloning.js') diff --git a/js/src/jit-test/tests/basic/testScriptCloning.js b/js/src/jit-test/tests/basic/testScriptCloning.js new file mode 100644 index 0000000000..2d9eaccd49 --- /dev/null +++ b/js/src/jit-test/tests/basic/testScriptCloning.js @@ -0,0 +1,22 @@ +var g = newGlobal(); + +var f; +f = cloneAndExecuteScript('(function(x) { return x })', g); +assertEq(f(9), 9); + +f = cloneAndExecuteScript('(function(x) { { let y = x+1; return y } })', g); +assertEq(f(9), 10); + +f = cloneAndExecuteScript('(function(x) { { let y = x, z = 1; return y+z } })', g); +assertEq(f(9), 10); + +f = cloneAndExecuteScript('(function(x) { return x.search(/ponies/) })', g); +assertEq(f('123ponies'), 3); + +f = cloneAndExecuteScript('(function(x, y) { return x.search(/a/) + y.search(/b/) })', g); +assertEq(f('12a','foo'), 1); + +f = cloneAndExecuteScript('(function(x) { switch(x) { case "a": return "b"; case null: return "c" } })', g); +assertEq(f('a'), "b"); +assertEq(f(null), "c"); +assertEq(f(3), undefined); -- cgit v1.2.3