summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r--Libraries/LibJS/Tests/parser-unary-associativity.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/parser-unary-associativity.js b/Libraries/LibJS/Tests/parser-unary-associativity.js
new file mode 100644
index 0000000000..240b20f61c
--- /dev/null
+++ b/Libraries/LibJS/Tests/parser-unary-associativity.js
@@ -0,0 +1,18 @@
+function assert(x) { if (!x) throw 1; }
+
+try {
+ var o = {};
+ o.a = 1;
+
+ assert(o.a === 1);
+ assert(!o.a === false);
+ assert(!o.a === !(o.a));
+ assert(~o.a === ~(o.a));
+
+ assert((typeof "x" === "string") === true);
+ assert(!(typeof "x" === "string") === false);
+
+ console.log("PASS");
+} catch (e) {
+ console.log("FAIL: " + e);
+}