From 1d0dbc5726dba93dd04bf51ffa1dd67cbb3a69f5 Mon Sep 17 00:00:00 2001 From: Mike Pennisi <mike@mikepennisi.com> Date: Wed, 29 Jun 2016 16:41:09 -0400 Subject: [PATCH] Assert absense of internal slot on RegExpPrototype The previous commit removed two invalid tests designed to ensure that the RegExpPrototype object is not itself a RegExp object. Introduce a new test to assert this detail in a way that accounts for the possibility of host extensions. --- .../RegExp/prototype/no-regexp-matcher.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/built-ins/RegExp/prototype/no-regexp-matcher.js diff --git a/test/built-ins/RegExp/prototype/no-regexp-matcher.js b/test/built-ins/RegExp/prototype/no-regexp-matcher.js new file mode 100644 index 0000000000..6af0de2d6d --- /dev/null +++ b/test/built-ins/RegExp/prototype/no-regexp-matcher.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-properties-of-the-regexp-prototype-object +es6id: 21.2.5 +description: > + The RegExp prototype object does not have a [[RegExpMatcher]] internal slot +info: | + The RegExp prototype object is an ordinary object. It is not a RegExp + instance and does not have a [[RegExpMatcher]] internal slot or any of the + other internal slots of RegExp instance objects. + + 21.2.5.2 RegExp.prototype.exec + + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have a [[RegExpMatcher]] internal slot, throw a TypeError + exception. +---*/ + +assert.throws(TypeError, function() { + RegExp.prototype.exec(''); +}); -- GitLab