From 2944eb2eca56d19abdcaa5827f06b0239af6273c Mon Sep 17 00:00:00 2001 From: rwaldron Date: Wed, 11 Aug 2021 15:06:41 -0400 Subject: [PATCH] Transform legacy format to harness assertions: test/built-ins/J*/**/*.js --- test/built-ins/JSON/parse/S15.12.2_A1.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/built-ins/JSON/parse/S15.12.2_A1.js b/test/built-ins/JSON/parse/S15.12.2_A1.js index 8cb2a8e5f5..399556835b 100644 --- a/test/built-ins/JSON/parse/S15.12.2_A1.js +++ b/test/built-ins/JSON/parse/S15.12.2_A1.js @@ -8,9 +8,11 @@ description: Tests that JSON.parse treats "__proto__" as a regular property name ---*/ var x = JSON.parse('{"__proto__":[]}'); -if (Object.getPrototypeOf(x) !== Object.prototype) { - throw new Test262Error('#1: JSON.parse confused by "__proto__"'); -} -if (!Array.isArray(x.__proto__)) { - throw new Test262Error('#2: JSON.parse did not set "__proto__" as a regular property'); -} + +assert.sameValue( + Object.getPrototypeOf(x), + Object.prototype, + 'Object.getPrototypeOf("JSON.parse(\'{"__proto__":[]}\')") returns Object.prototype' +); + +assert(Array.isArray(x.__proto__), 'Array.isArray(x.__proto__) must return true');