diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/RegExp/prototype/dotAll | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/dotAll')
10 files changed, 271 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/browser.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/browser.js diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/cross-realm.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/cross-realm.js new file mode 100644 index 0000000000..baa13fadd5 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/cross-realm.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 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.dotall +description: Invoked on a cross-realm object +info: | + get RegExp.prototype.dotAll + + 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. +features: [regexp-dotall, cross-realm] +---*/ + +var dotAll = Object.getOwnPropertyDescriptor(RegExp.prototype, 'dotAll').get; +var other = $262.createRealm().global; +var otherRegExpProto = other.RegExp.prototype; +var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'dotAll').get; + +assert.throws(TypeError, function() { + dotAll.call(otherRegExpProto); +}, 'cross-realm RegExp.prototype'); + +assert.throws(other.TypeError, function() { + otherRegExpGetter.call(RegExp.prototype); +}, 'cross-realm RegExp.prototype getter method against primary realm RegExp.prototype'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/length.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/length.js new file mode 100644 index 0000000000..1a6bb3afe2 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/length.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-regexp.prototype.dotall +description: > + get RegExp.prototype.dotAll.length is 0. +info: | + get RegExp.prototype.dotAll + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [regexp-dotall] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, "dotAll"); + +assert.sameValue(desc.get.length, 0); + +verifyProperty(desc.get, "length", { + enumerable: false, + writable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/name.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/name.js new file mode 100644 index 0000000000..15d9117e62 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 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.dotall +description: > + RegExp.prototype.dotAll name +info: | + 17 ECMAScript Standard Built-in Objects + + Functions that are specified as get or set accessor functions of built-in + properties have "get " or "set " prepended to the property name string. +includes: [propertyHelper.js] +features: [regexp-dotall] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, "dotAll"); + +assert.sameValue( + desc.get.name, + "get dotAll" +); + +verifyProperty(desc.get, "name", { + enumerable: false, + writable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/prop-desc.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/prop-desc.js new file mode 100644 index 0000000000..dd00e948bb --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/prop-desc.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 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.dotall +description: > + `pending` property descriptor +info: | + RegExp.prototype.dotAll is an accessor property whose set accessor + function is undefined. + + 17 ECMAScript Standard Built-in Objects + + Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes + { [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. If only a get + accessor function is described, the set accessor function is the default value, undefined. If + only a set accessor is described the get accessor is the default value, undefined. +includes: [propertyHelper.js] +features: [regexp-dotall] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, "dotAll"); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, "function"); + +verifyProperty(RegExp.prototype, "dotAll", { + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/shell.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/shell.js diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js new file mode 100644 index 0000000000..76196d39f0 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-invalid-obj.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 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.dotall +description: Invoked on an object without an [[OriginalFlags]] internal slot +info: | + get RegExp.prototype.dotAll + + 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. +features: [regexp-dotall] +---*/ + +var dotAll = Object.getOwnPropertyDescriptor(RegExp.prototype, 'dotAll').get; + +assert.throws(TypeError, function() { + dotAll.call({}); +}, 'ordinary object'); + +assert.throws(TypeError, function() { + dotAll.call([]); +}, 'array exotic object'); + +assert.throws(TypeError, function() { + dotAll.call(arguments); +}, 'arguments object'); + +assert.throws(TypeError, function() { + dotAll.call(() => {}); +}, 'function object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-non-obj.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-non-obj.js new file mode 100644 index 0000000000..1e6e0b16de --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-non-obj.js @@ -0,0 +1,46 @@ +// Copyright (C) 2017 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.dotall +description: > + `dotAll` accessor invoked on a non-object value +info: | + get RegExp.prototype.dotAll + + 1. Let R be the this value. + 2. If Type(R) is not Object, throw a TypeError exception. +features: [Symbol, regexp-dotall] +---*/ + +var dotAll = Object.getOwnPropertyDescriptor(RegExp.prototype, "dotAll").get; + +assert.throws(TypeError, function() { + dotAll.call(undefined); +}, "undefined"); + +assert.throws(TypeError, function() { + dotAll.call(null); +}, "null"); + +assert.throws(TypeError, function() { + dotAll.call(true); +}, "true"); + +assert.throws(TypeError, function() { + dotAll.call("string"); +}, "string"); + +assert.throws(TypeError, function() { + dotAll.call(Symbol("s")); +}, "symbol"); + +assert.throws(TypeError, function() { + dotAll.call(4); +}, "number"); + +assert.throws(TypeError, function() { + dotAll.call(4n); +}, "bigint"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-regexp-prototype.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-regexp-prototype.js new file mode 100644 index 0000000000..fc4f7178c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-regexp-prototype.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 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.dotall +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. +features: [regexp-dotall] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, "dotAll").get; + +assert.sameValue(get.call(RegExp.prototype), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-regexp.js b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-regexp.js new file mode 100644 index 0000000000..428d2c78dc --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/dotAll/this-val-regexp.js @@ -0,0 +1,41 @@ +// Copyright (C) 2017 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.dotall +description: > + `dotAll` accessor function invoked on a RegExp instance +info: | + 21.2.5.12 get RegExp.prototype.dotAll + + 4. Let flags be the value of R’s [[OriginalFlags]] internal slot. + 5. If flags contains the code unit "s", return true. + 6. Return false. +features: [regexp-dotall] +---*/ + +assert.sameValue(/./.dotAll, false, "/./.dotAll"); +assert.sameValue(/./i.dotAll, false, "/./i.dotAll"); +assert.sameValue(/./g.dotAll, false, "/./g.dotAll"); +assert.sameValue(/./y.dotAll, false, "/./y.dotAll"); +assert.sameValue(/./m.dotAll, false, "/./m.dotAll"); + +assert.sameValue(/./s.dotAll, true, "/./s.dotAll"); +assert.sameValue(/./is.dotAll, true, "/./is.dotAll"); +assert.sameValue(/./sg.dotAll, true, "/./sg.dotAll"); +assert.sameValue(/./sy.dotAll, true, "/./sy.dotAll"); +assert.sameValue(/./ms.dotAll, true, "/./ms.dotAll"); + +assert.sameValue(new RegExp(".", "").dotAll, false, "new RegExp('.', '').dotAll"); +assert.sameValue(new RegExp(".", "i").dotAll, false, "new RegExp('.', 'i').dotAll"); +assert.sameValue(new RegExp(".", "g").dotAll, false, "new RegExp('.', 'g').dotAll"); +assert.sameValue(new RegExp(".", "y").dotAll, false, "new RegExp('.', 'y').dotAll"); +assert.sameValue(new RegExp(".", "m").dotAll, false, "new RegExp('.', 'm').dotAll"); + +assert.sameValue(new RegExp(".", "s").dotAll, true, "new RegExp('.', 's').dotAll"); +assert.sameValue(new RegExp(".", "is").dotAll, true, "new RegExp('.', 'is').dotAll"); +assert.sameValue(new RegExp(".", "sg").dotAll, true, "new RegExp('.', 'sg').dotAll"); +assert.sameValue(new RegExp(".", "sy").dotAll, true, "new RegExp('.', 'sy').dotAll"); +assert.sameValue(new RegExp(".", "ms").dotAll, true, "new RegExp('.', 'ms').dotAll"); + +reportCompare(0, 0); |