mirror of
https://github.com/tc39/test262.git
synced 2025-09-26 03:28:50 +02:00
Enable strict mode testing for sm/JSON/parse-with-source.js
This commit is contained in:
parent
15be7166d5
commit
0ee9b57cba
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
/*---
|
/*---
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
flags:
|
|
||||||
- noStrict
|
|
||||||
description: |
|
description: |
|
||||||
pending
|
pending
|
||||||
esid: pending
|
esid: pending
|
||||||
@ -121,11 +119,12 @@ features: [json-parse-with-source]
|
|||||||
assert.sameValue(obj.rawJSON, "false");
|
assert.sameValue(obj.rawJSON, "false");
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(function checkErrorsComeFromCorrectRealm() {
|
// Check errors come from correct realm.
|
||||||
|
{
|
||||||
const otherGlobal = $262.createRealm().global;
|
const otherGlobal = $262.createRealm().global;
|
||||||
assert.sameValue(TypeError !== otherGlobal.TypeError, true);
|
assert.sameValue(TypeError !== otherGlobal.TypeError, true);
|
||||||
|
|
||||||
assertErrorComesFromCorrectRealm = (fun, thisRealmType) => {
|
let assertErrorComesFromCorrectRealm = (fun, thisRealmType) => {
|
||||||
assert.throws(thisRealmType, () => fun(this),
|
assert.throws(thisRealmType, () => fun(this),
|
||||||
`${thisRealmType.name} should come from this realm.`);
|
`${thisRealmType.name} should come from this realm.`);
|
||||||
assert.throws(otherGlobal[thisRealmType.name], () => fun(otherGlobal),
|
assert.throws(otherGlobal[thisRealmType.name], () => fun(otherGlobal),
|
||||||
@ -142,5 +141,4 @@ features: [json-parse-with-source]
|
|||||||
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('123\n'), SyntaxError);
|
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('123\n'), SyntaxError);
|
||||||
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('\t123'), SyntaxError);
|
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('\t123'), SyntaxError);
|
||||||
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON(''), SyntaxError);
|
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON(''), SyntaxError);
|
||||||
})();
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user