mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibJS: Add a basic unit test for the "with" statement
This commit is contained in:
parent
9de6443ab7
commit
1fad95fec5
Notes:
sideshowbarker
2024-07-19 01:12:56 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1fad95fec5d
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…
Reference in a new issue