ladybird/Libraries/LibJS/Tests/operators/ternary-basic.js
2020-07-06 23:40:35 +02:00

16 lines
418 B
JavaScript

test("basic functionality", () => {
const x = 1;
expect(x === 1 ? true : false).toBeTrue();
expect(x ? x : 0).toBe(x);
expect(1 < 2 ? true : false).toBeTrue();
expect(0 ? 1 : 1 ? 10 : 20).toBe(10);
expect(0 ? (1 ? 1 : 10) : 20).toBe(20);
});
test("object values", () => {
const o = {};
o.f = true;
expect(o.f ? true : false).toBeTrue();
expect(1 ? o.f : null).toBeTrue();
});