mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 22:15:08 +00:00
LibJS: Add a basic unit test for the "with" statement
This commit is contained in:
parent
9de6443ab7
commit
1fad95fec5
1 changed files with 20 additions and 0 deletions
20
Libraries/LibJS/Tests/with-basic.js
Normal file
20
Libraries/LibJS/Tests/with-basic.js
Normal 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);
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue