2020-10-24 13:50:59 +01:00
|
|
|
test("valid 'use strict; directive", () => {
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
"use strict";
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeTrue();
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
'use strict';
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeTrue();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("invalid 'use strict; directive", () => {
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
" use strict ";
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
`use strict`;
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
"use\
|
|
|
|
|
strict";
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
"use\ strict";
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
"use \163trict";
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
2020-11-01 21:49:25 +00:00
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
`"use strict"`;
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
|
|
|
|
expect(
|
|
|
|
|
(() => {
|
|
|
|
|
"use strict" + 1;
|
|
|
|
|
return isStrictMode();
|
|
|
|
|
})()
|
|
|
|
|
).toBeFalse();
|
2020-10-24 13:50:59 +01:00
|
|
|
});
|