summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testUnaryImacros.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/basic/testUnaryImacros.js')
-rw-r--r--js/src/jit-test/tests/basic/testUnaryImacros.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testUnaryImacros.js b/js/src/jit-test/tests/basic/testUnaryImacros.js
new file mode 100644
index 000000000..884d856d2
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testUnaryImacros.js
@@ -0,0 +1,26 @@
+function testUnaryImacros()
+{
+ function checkArg(x)
+ {
+ return 1;
+ }
+
+ var o = { valueOf: checkArg, toString: null };
+ var count = 0;
+ var v = 0;
+ for (var i = 0; i < 5; i++)
+ v += +o + -(-o);
+
+ var results = [v === 10 ? "valueOf passed" : "valueOf failed"];
+
+ o.valueOf = null;
+ o.toString = checkArg;
+
+ for (var i = 0; i < 5; i++)
+ v += +o + -(-o);
+
+ results.push(v === 20 ? "toString passed" : "toString failed");
+
+ return results.join(", ");
+}
+assertEq(testUnaryImacros(), "valueOf passed, toString passed");