diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/JSON/parse/text-object-abrupt.js')
-rw-r--r-- | js/src/tests/test262/built-ins/JSON/parse/text-object-abrupt.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/JSON/parse/text-object-abrupt.js b/js/src/tests/test262/built-ins/JSON/parse/text-object-abrupt.js new file mode 100644 index 0000000000..aa0a7a70ef --- /dev/null +++ b/js/src/tests/test262/built-ins/JSON/parse/text-object-abrupt.js @@ -0,0 +1,30 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-json.parse +description: > + Abrupt completion from Get and Call in ToPrimitive. +info: | + JSON.parse ( text [ , reviver ] ) + + 1. Let JText be ? ToString(text). +---*/ + +assert.throws(Test262Error, function() { + JSON.parse({ + toString: null, + get valueOf() { + throw new Test262Error(); + }, + }); +}); + +assert.throws(Test262Error, function() { + JSON.parse({ + toString: function() { + throw new Test262Error(); + }, + }); +}); + +reportCompare(0, 0); |