mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 23:19:44 +00:00
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Previously, the given test would create an object with the test property that pointed to itself. This is because `temp = temp.test || {}` overwrote the `temp` local register, and `temp.test = temp` used the new object instead of the original one it fetched. Allows https://www.yorkshiretea.co.uk/ to load, which was failing in Gsap library initialization.
33 lines
719 B
JavaScript
33 lines
719 B
JavaScript
test("Assignment should always evaluate LHS first", () => {
|
|
function go(a) {
|
|
let i = 0;
|
|
a[i] = a[++i];
|
|
}
|
|
|
|
let a = [1, 2, 3];
|
|
go(a);
|
|
expect(a).toEqual([2, 2, 3]);
|
|
});
|
|
|
|
test("Binary assignment should always evaluate LHS first", () => {
|
|
function go(a) {
|
|
let i = 0;
|
|
a[i] |= a[++i];
|
|
}
|
|
|
|
let a = [1, 2];
|
|
go(a);
|
|
expect(a).toEqual([3, 2]);
|
|
});
|
|
|
|
test("Base object of lhs of assignment is copied to preserve evaluation order", () => {
|
|
let topLevel = {};
|
|
function go() {
|
|
let temp = topLevel;
|
|
temp.test = temp = temp.test || {};
|
|
}
|
|
|
|
go();
|
|
expect(topLevel.test).not.toBeUndefined();
|
|
expect(topLevel.test).toEqual({});
|
|
});
|