
This fixes the following from parsing incorrectly due to the comma that occurs after the conditional: let o = { foo: true ? 1 : 2, bar: 'baz', };
21 lines
403 B
JavaScript
21 lines
403 B
JavaScript
load("test-common.js");
|
|
|
|
try {
|
|
var x = 1;
|
|
|
|
assert(x === 1 ? true : false);
|
|
assert((x ? x : 0) === x);
|
|
assert(1 < 2 ? (true) : (false));
|
|
assert((0 ? 1 : 1 ? 10 : 20) === 10);
|
|
assert((0 ? 1 ? 1 : 10 : 20) === 20);
|
|
|
|
var o = {};
|
|
o.f = true;
|
|
assert(o.f ? true : false);
|
|
|
|
assert(1 ? o.f : null);
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|