mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:25:06 +00:00
LibJS: Convert all remaining non-Array tests to the new system :)
This commit is contained in:
parent
918f4affd5
commit
15de2eda2b
72 changed files with 2394 additions and 1998 deletions
|
@ -1,52 +1,53 @@
|
|||
load("test-common.js");
|
||||
// This file must not be formatted by prettier. Make sure your IDE
|
||||
// respects the .prettierignore file!
|
||||
|
||||
try {
|
||||
(function () {
|
||||
assert(!isStrictMode());
|
||||
test("non strict-mode by default", () => {
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict with double quotes", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
});
|
||||
|
||||
test("use strict with single quotes", () => {
|
||||
'use strict';
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
});
|
||||
|
||||
test("use strict with backticks does not yield strict mode", () => {
|
||||
`use strict`;
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict with single quotes after statement does not yield strict mode code", () => {
|
||||
;'use strict';
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("use strict with double quotes after statement does not yield strict mode code", () => {
|
||||
;"use strict";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
test("strict mode propogates down the scope chain", () => {
|
||||
"use strict";
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
(function() {
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
})();
|
||||
});
|
||||
|
||||
(function () {
|
||||
test("strict mode does not propogate up the scope chain", () => {
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
(function() {
|
||||
"use strict";
|
||||
assert(isStrictMode());
|
||||
expect(isStrictMode()).toBeTrue();
|
||||
})();
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
assert(isStrictMode());
|
||||
})();
|
||||
|
||||
(function () {
|
||||
`use strict`;
|
||||
assert(!isStrictMode());
|
||||
})();
|
||||
|
||||
(function () {
|
||||
("use strict");
|
||||
assert(!isStrictMode());
|
||||
})();
|
||||
|
||||
(function () {
|
||||
("use strict");
|
||||
assert(!isStrictMode());
|
||||
})();
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
(function () {
|
||||
assert(isStrictMode());
|
||||
})();
|
||||
})();
|
||||
|
||||
(function () {
|
||||
assert(!isStrictMode());
|
||||
(function () {
|
||||
"use strict";
|
||||
assert(isStrictMode());
|
||||
})();
|
||||
assert(!isStrictMode());
|
||||
})();
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
||||
test('only the string "use strict" yields strict mode code', () => {
|
||||
"use stric";
|
||||
expect(isStrictMode()).toBeFalse();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue