mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
69
Libraries/LibJS/Tests/functions/function-strict-mode.js
Normal file
69
Libraries/LibJS/Tests/functions/function-strict-mode.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
test("non strict-mode by default", () => {
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict with double quotes", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with single quotes", () => {
|
||||
'use strict';
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with backticks does not yield strict mode", () => {
|
||||
`use strict`;
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with single quotes after statement does not yield strict mode code", () => {
|
||||
;'use strict';
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
// prettier-ignore
|
||||
test("use strict with double quotes after statement does not yield strict mode code", () => {
|
||||
;"use strict";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict interrupted by a line continuation does not yield strict mode code", () => {
|
||||
"use \
|
||||
strict";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("strict mode propagates down the scope chain", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
(function () {
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
})();
|
||||
});
|
||||
|
||||
test("strict mode does not propagate up the scope chain", () => {
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
(function () {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
})();
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test('only the string "use strict" yields strict mode code', () => {
|
||||
"use stric";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("strict mode does not apply global object to |this|", () => {
|
||||
"use strict";
|
||||
let functionThis;
|
||||
(function () {
|
||||
functionThis = this;
|
||||
})();
|
||||
expect(functionThis).toBeUndefined();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue