LibJS: Add a basic unit test for the "with" statement

This commit is contained in:
Andreas Kling 2020-11-28 16:19:28 +01:00
parent 9de6443ab7
commit 1fad95fec5
Notes: sideshowbarker 2024-07-19 01:12:56 +09:00

View file

@ -0,0 +1,20 @@
test("basic with statement functionality", () => {
var object = { "foo": 5, "bar": 6, "baz": 7 };
var qux = 1;
var bar = 99;
with (object) {
expect(foo).toBe(5);
expect(bar).toBe(6);
expect(baz).toBe(7);
expect(qux).toBe(1);
expect(typeof quz).toBe("undefined");
bar = 2;
}
expect(object.bar).toBe(2);
expect(bar).toBe(99);
});