From e1cd1e7f8561aad135cf0a66694ac65cb38c7fc5 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 28 Jun 2016 17:29:33 -0400 Subject: [PATCH] Update and tests for %RegExpPrototype% methods A recent web-compatability change to ECMA262 modified the semantics of the accessor methods on the %RegExpPrototype% intrinsic--the "get" accessors now include steps dedicated to the case where the "this" value is the %RegExpPrototype% object itself. Remove the tests that have been invalidated by this change, introduce tests asserting the new behavior, and extend coverage for other possible "this" values. --- .../RegExp/prototype/global/15.10.7.2-1.js | 12 ------ .../prototype/global/this-val-invalid-obj.js | 27 +++++++++++++ .../prototype/global/this-val-non-obj.js | 38 +++++++++++++++++++ .../global/this-val-regexp-prototype.js | 17 +++++++++ .../prototype/ignoreCase/15.10.7.3-1.js | 12 ------ .../ignoreCase/this-val-invalid-obj.js | 27 +++++++++++++ .../prototype/ignoreCase/this-val-non-obj.js | 38 +++++++++++++++++++ .../ignoreCase/this-val-regexp-prototype.js | 17 +++++++++ .../RegExp/prototype/multiline/15.10.7.4-1.js | 12 ------ .../multiline/this-val-invalid-obj.js | 27 +++++++++++++ .../prototype/multiline/this-val-non-obj.js | 38 +++++++++++++++++++ .../multiline/this-val-regexp-prototype.js | 17 +++++++++ .../RegExp/prototype/source/15.10.7.1-1.js | 12 ------ .../prototype/source/this-val-invalid-obj.js | 27 +++++++++++++ .../prototype/source/this-val-non-obj.js | 38 +++++++++++++++++++ .../source/this-val-regexp-prototype.js | 17 +++++++++ ...invalid-obj.js => this-val-invalid-obj.js} | 10 ++++- .../{this-non-obj.js => this-val-non-obj.js} | 0 .../sticky/this-val-regexp-prototype.js | 17 +++++++++ .../{this-regexp.js => this-val-regexp.js} | 0 ...-invald-obj.js => this-val-invalid-obj.js} | 10 ++++- .../{this-non-obj.js => this-val-non-obj.js} | 0 .../unicode/this-val-regexp-prototype.js | 17 +++++++++ .../{this-regexp.js => this-val-regexp.js} | 0 24 files changed, 380 insertions(+), 50 deletions(-) delete mode 100644 test/built-ins/RegExp/prototype/global/15.10.7.2-1.js create mode 100644 test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js create mode 100644 test/built-ins/RegExp/prototype/global/this-val-non-obj.js create mode 100644 test/built-ins/RegExp/prototype/global/this-val-regexp-prototype.js delete mode 100644 test/built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1.js create mode 100644 test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js create mode 100644 test/built-ins/RegExp/prototype/ignoreCase/this-val-non-obj.js create mode 100644 test/built-ins/RegExp/prototype/ignoreCase/this-val-regexp-prototype.js delete mode 100644 test/built-ins/RegExp/prototype/multiline/15.10.7.4-1.js create mode 100644 test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js create mode 100644 test/built-ins/RegExp/prototype/multiline/this-val-non-obj.js create mode 100644 test/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js delete mode 100644 test/built-ins/RegExp/prototype/source/15.10.7.1-1.js create mode 100644 test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js create mode 100644 test/built-ins/RegExp/prototype/source/this-val-non-obj.js create mode 100644 test/built-ins/RegExp/prototype/source/this-val-regexp-prototype.js rename test/built-ins/RegExp/prototype/sticky/{this-invalid-obj.js => this-val-invalid-obj.js} (76%) rename test/built-ins/RegExp/prototype/sticky/{this-non-obj.js => this-val-non-obj.js} (100%) create mode 100644 test/built-ins/RegExp/prototype/sticky/this-val-regexp-prototype.js rename test/built-ins/RegExp/prototype/sticky/{this-regexp.js => this-val-regexp.js} (100%) rename test/built-ins/RegExp/prototype/unicode/{this-invald-obj.js => this-val-invalid-obj.js} (75%) rename test/built-ins/RegExp/prototype/unicode/{this-non-obj.js => this-val-non-obj.js} (100%) create mode 100644 test/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js rename test/built-ins/RegExp/prototype/unicode/{this-regexp.js => this-val-regexp.js} (100%) diff --git a/test/built-ins/RegExp/prototype/global/15.10.7.2-1.js b/test/built-ins/RegExp/prototype/global/15.10.7.2-1.js deleted file mode 100644 index 6360511a45..0000000000 --- a/test/built-ins/RegExp/prototype/global/15.10.7.2-1.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.10.7.2-1 -description: RegExp.prototype.global is a non-generic accessor property ----*/ - - -assert.throws(TypeError, function() { - RegExp.prototype.global; -}); diff --git a/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js new file mode 100644 index 0000000000..123373d483 --- /dev/null +++ b/test/built-ins/RegExp/prototype/global/this-val-invalid-obj.js @@ -0,0 +1,27 @@ +// 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-get-regexp.prototype.global +es6id: 21.2.5.4 +description: A TypeError is thrown when the "this" value is an invalid Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. + b. Otherwise, throw a TypeError exception. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'global').get; + +assert.throws(TypeError, function() { + get.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + get.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + get.call(arguments); +}, 'arguments object'); diff --git a/test/built-ins/RegExp/prototype/global/this-val-non-obj.js b/test/built-ins/RegExp/prototype/global/this-val-non-obj.js new file mode 100644 index 0000000000..b30ff6b759 --- /dev/null +++ b/test/built-ins/RegExp/prototype/global/this-val-non-obj.js @@ -0,0 +1,38 @@ +// 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-get-regexp.prototype.global +es6id: 21.2.5.4 +description: A TypeError is thrown when the "this" value is not an Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'global').get; +var symbol = Symbol(); + +assert.throws(TypeError, function() { + get.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + get.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + get.call(3); +}, 'number'); + +assert.throws(TypeError, function() { + get.call('string'); +}, 'string'); + +assert.throws(TypeError, function() { + get.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + get.call(symbol); +}, 'symbol'); diff --git a/test/built-ins/RegExp/prototype/global/this-val-regexp-prototype.js b/test/built-ins/RegExp/prototype/global/this-val-regexp-prototype.js new file mode 100644 index 0000000000..0754e95448 --- /dev/null +++ b/test/built-ins/RegExp/prototype/global/this-val-regexp-prototype.js @@ -0,0 +1,17 @@ +// 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-get-regexp.prototype.global +description: > + Return value of `undefined` when the "this" value is the RegExp prototype + object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'global').get; + +assert.sameValue(get.call(RegExp.prototype), undefined); diff --git a/test/built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1.js b/test/built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1.js deleted file mode 100644 index 53eb90a90b..0000000000 --- a/test/built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.10.7.3-1 -description: RegExp.prototype.ignoreCase is a non-generic accessor property ----*/ - - -assert.throws(TypeError, function() { - RegExp.prototype.ignoreCase; -}); diff --git a/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js new file mode 100644 index 0000000000..b08d8e524b --- /dev/null +++ b/test/built-ins/RegExp/prototype/ignoreCase/this-val-invalid-obj.js @@ -0,0 +1,27 @@ +// 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-get-regexp.prototype.ignorecase +es6id: 21.2.5.5 +description: A TypeError is thrown when the "this" value is an invalid Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. + b. Otherwise, throw a TypeError exception. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get; + +assert.throws(TypeError, function() { + get.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + get.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + get.call(arguments); +}, 'arguments object'); diff --git a/test/built-ins/RegExp/prototype/ignoreCase/this-val-non-obj.js b/test/built-ins/RegExp/prototype/ignoreCase/this-val-non-obj.js new file mode 100644 index 0000000000..1c507b865b --- /dev/null +++ b/test/built-ins/RegExp/prototype/ignoreCase/this-val-non-obj.js @@ -0,0 +1,38 @@ +// 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-get-regexp.prototype.ignorecase +es6id: 21.2.5.5 +description: A TypeError is thrown when the "this" value is not an Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get; +var symbol = Symbol(); + +assert.throws(TypeError, function() { + get.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + get.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + get.call(3); +}, 'number'); + +assert.throws(TypeError, function() { + get.call('string'); +}, 'string'); + +assert.throws(TypeError, function() { + get.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + get.call(symbol); +}, 'symbol'); diff --git a/test/built-ins/RegExp/prototype/ignoreCase/this-val-regexp-prototype.js b/test/built-ins/RegExp/prototype/ignoreCase/this-val-regexp-prototype.js new file mode 100644 index 0000000000..34bcd64b79 --- /dev/null +++ b/test/built-ins/RegExp/prototype/ignoreCase/this-val-regexp-prototype.js @@ -0,0 +1,17 @@ +// 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-get-regexp.prototype.ignorecase +description: > + Return value of `undefined` when the "this" value is the RegExp prototype + object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get; + +assert.sameValue(get.call(RegExp.prototype), undefined); diff --git a/test/built-ins/RegExp/prototype/multiline/15.10.7.4-1.js b/test/built-ins/RegExp/prototype/multiline/15.10.7.4-1.js deleted file mode 100644 index d0721f8f55..0000000000 --- a/test/built-ins/RegExp/prototype/multiline/15.10.7.4-1.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.10.7.4-1 -description: RegExp.prototype.multiline is a non-generic accessor property ----*/ - - -assert.throws(TypeError, function() { - RegExp.prototype.multiline; -}); diff --git a/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js new file mode 100644 index 0000000000..85a8b78b87 --- /dev/null +++ b/test/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js @@ -0,0 +1,27 @@ +// 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-get-regexp.prototype.multiline +es6id: 21.2.5.7 +description: A TypeError is thrown when the "this" value is an invalid Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. + b. Otherwise, throw a TypeError exception. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get; + +assert.throws(TypeError, function() { + get.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + get.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + get.call(arguments); +}, 'arguments object'); diff --git a/test/built-ins/RegExp/prototype/multiline/this-val-non-obj.js b/test/built-ins/RegExp/prototype/multiline/this-val-non-obj.js new file mode 100644 index 0000000000..007ed55724 --- /dev/null +++ b/test/built-ins/RegExp/prototype/multiline/this-val-non-obj.js @@ -0,0 +1,38 @@ +// 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-get-regexp.prototype.multiline +es6id: 21.2.5.7 +description: A TypeError is thrown when the "this" value is not an Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get; +var symbol = Symbol(); + +assert.throws(TypeError, function() { + get.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + get.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + get.call(3); +}, 'number'); + +assert.throws(TypeError, function() { + get.call('string'); +}, 'string'); + +assert.throws(TypeError, function() { + get.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + get.call(symbol); +}, 'symbol'); diff --git a/test/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js b/test/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js new file mode 100644 index 0000000000..cfc08ce05b --- /dev/null +++ b/test/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js @@ -0,0 +1,17 @@ +// 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-get-regexp.prototype.multiline +description: > + Return value of `undefined` when the "this" value is the RegExp prototype + object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get; + +assert.sameValue(get.call(RegExp.prototype), undefined); diff --git a/test/built-ins/RegExp/prototype/source/15.10.7.1-1.js b/test/built-ins/RegExp/prototype/source/15.10.7.1-1.js deleted file mode 100644 index 3a6b8130b0..0000000000 --- a/test/built-ins/RegExp/prototype/source/15.10.7.1-1.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.10.7.1-1 -description: RegExp.prototype.source is a non-generic accessor property ----*/ - - -assert.throws(TypeError, function() { - RegExp.prototype.source; -}); diff --git a/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js b/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js new file mode 100644 index 0000000000..bf136a4abe --- /dev/null +++ b/test/built-ins/RegExp/prototype/source/this-val-invalid-obj.js @@ -0,0 +1,27 @@ +// 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-get-regexp.prototype.source +es6id: 21.2.5.10 +description: A TypeError is thrown when the "this" value is an invalid Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return "(?:)". + b. Otherwise, throw a TypeError exception. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get; + +assert.throws(TypeError, function() { + get.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + get.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + get.call(arguments); +}, 'arguments object'); diff --git a/test/built-ins/RegExp/prototype/source/this-val-non-obj.js b/test/built-ins/RegExp/prototype/source/this-val-non-obj.js new file mode 100644 index 0000000000..e0d3dcb860 --- /dev/null +++ b/test/built-ins/RegExp/prototype/source/this-val-non-obj.js @@ -0,0 +1,38 @@ +// 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-get-regexp.prototype.source +es6id: 21.2.5.10 +description: A TypeError is thrown when the "this" value is not an Object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. +features: [Symbol] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get; +var symbol = Symbol(); + +assert.throws(TypeError, function() { + get.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + get.call(null); +}, 'null'); + +assert.throws(TypeError, function() { + get.call(3); +}, 'number'); + +assert.throws(TypeError, function() { + get.call('string'); +}, 'string'); + +assert.throws(TypeError, function() { + get.call(true); +}, 'boolean'); + +assert.throws(TypeError, function() { + get.call(symbol); +}, 'symbol'); diff --git a/test/built-ins/RegExp/prototype/source/this-val-regexp-prototype.js b/test/built-ins/RegExp/prototype/source/this-val-regexp-prototype.js new file mode 100644 index 0000000000..5161465e4c --- /dev/null +++ b/test/built-ins/RegExp/prototype/source/this-val-regexp-prototype.js @@ -0,0 +1,17 @@ +// 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-get-regexp.prototype.source +description: > + Return value of `undefined` when the "this" value is the RegExp prototype + object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return "(?:)". +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get; + +assert.sameValue(get.call(RegExp.prototype), '(?:)'); diff --git a/test/built-ins/RegExp/prototype/sticky/this-invalid-obj.js b/test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js similarity index 76% rename from test/built-ins/RegExp/prototype/sticky/this-invalid-obj.js rename to test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js index cf1952a99a..8c15356a2d 100644 --- a/test/built-ins/RegExp/prototype/sticky/this-invalid-obj.js +++ b/test/built-ins/RegExp/prototype/sticky/this-val-invalid-obj.js @@ -17,4 +17,12 @@ var sticky = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get; assert.throws(TypeError, function() { sticky.call({}); -}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + sticky.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + sticky.call(arguments); +}, 'arguments object'); diff --git a/test/built-ins/RegExp/prototype/sticky/this-non-obj.js b/test/built-ins/RegExp/prototype/sticky/this-val-non-obj.js similarity index 100% rename from test/built-ins/RegExp/prototype/sticky/this-non-obj.js rename to test/built-ins/RegExp/prototype/sticky/this-val-non-obj.js diff --git a/test/built-ins/RegExp/prototype/sticky/this-val-regexp-prototype.js b/test/built-ins/RegExp/prototype/sticky/this-val-regexp-prototype.js new file mode 100644 index 0000000000..4f262738d7 --- /dev/null +++ b/test/built-ins/RegExp/prototype/sticky/this-val-regexp-prototype.js @@ -0,0 +1,17 @@ +// 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-get-regexp.prototype.sticky +description: > + Return value of `undefined` when the "this" value is the RegExp prototype + object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get; + +assert.sameValue(get.call(RegExp.prototype), undefined); diff --git a/test/built-ins/RegExp/prototype/sticky/this-regexp.js b/test/built-ins/RegExp/prototype/sticky/this-val-regexp.js similarity index 100% rename from test/built-ins/RegExp/prototype/sticky/this-regexp.js rename to test/built-ins/RegExp/prototype/sticky/this-val-regexp.js diff --git a/test/built-ins/RegExp/prototype/unicode/this-invald-obj.js b/test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js similarity index 75% rename from test/built-ins/RegExp/prototype/unicode/this-invald-obj.js rename to test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js index 65505f64d1..e2b05c504b 100644 --- a/test/built-ins/RegExp/prototype/unicode/this-invald-obj.js +++ b/test/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js @@ -17,4 +17,12 @@ var unicode = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get; assert.throws(TypeError, function() { unicode.call({}); -}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + unicode.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + unicode.call(arguments); +}, 'arguments object'); diff --git a/test/built-ins/RegExp/prototype/unicode/this-non-obj.js b/test/built-ins/RegExp/prototype/unicode/this-val-non-obj.js similarity index 100% rename from test/built-ins/RegExp/prototype/unicode/this-non-obj.js rename to test/built-ins/RegExp/prototype/unicode/this-val-non-obj.js diff --git a/test/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js b/test/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js new file mode 100644 index 0000000000..7da953f968 --- /dev/null +++ b/test/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js @@ -0,0 +1,17 @@ +// 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-get-regexp.prototype.unicode +description: > + Return value of `undefined` when the "this" value is the RegExp prototype + object +info: | + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. + 3. If R does not have an [[OriginalFlags]] internal slot, then + a. If SameValue(R, %RegExpPrototype%) is true, return undefined. +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get; + +assert.sameValue(get.call(RegExp.prototype), undefined); diff --git a/test/built-ins/RegExp/prototype/unicode/this-regexp.js b/test/built-ins/RegExp/prototype/unicode/this-val-regexp.js similarity index 100% rename from test/built-ins/RegExp/prototype/unicode/this-regexp.js rename to test/built-ins/RegExp/prototype/unicode/this-val-regexp.js