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/multiline | |
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/multiline')
12 files changed, 275 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/15.10.7.4-2.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/15.10.7.4-2.js new file mode 100644 index 0000000000..d554e1046c --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/15.10.7.4-2.js @@ -0,0 +1,19 @@ +// 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-2 +description: > + RegExp.prototype.multiline is an accessor property whose set + accessor function is undefined +---*/ + + var d = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline'); + + +assert.sameValue(typeof d.get, 'function', 'typeof d.get'); +assert.sameValue(d.set, undefined, 'd.set'); +assert.sameValue(d.enumerable, false, 'd.enumerable'); +assert.sameValue(d.configurable, true, 'd.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js new file mode 100644 index 0000000000..b5d5653e08 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The RegExp.prototype multiline property does not have a set accessor +es5id: 15.10.7.4_A10 +description: Checking if varying the multiline property fails +includes: [propertyHelper.js] +---*/ + +var __re = RegExp.prototype; + +assert.sameValue(__re.hasOwnProperty('multiline'), true, '__re.hasOwnProperty(\'multiline\') must return true'); + +var __sample = /\n/; +var __obj = __sample.multiline; + +verifyNotWritable(__sample, "multiline", "multiline", "shifted"); + +assert.sameValue(__sample.multiline, __obj, 'The value of __sample.multiline is expected to equal the value of __obj'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A8.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A8.js new file mode 100644 index 0000000000..f4a2868a7b --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A8.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The RegExp.prototype multiline property has the attribute DontEnum +es5id: 15.10.7.4_A8 +description: > + Checking if enumerating the multiline property of RegExp.prototype + fails +---*/ + +var __re = RegExp.prototype; + +assert.sameValue(__re.hasOwnProperty('multiline'), true, '__re.hasOwnProperty(\'multiline\') must return true'); + +assert.sameValue( + __re.propertyIsEnumerable('multiline'), + false, + '__re.propertyIsEnumerable(\'multiline\') must return false' +); + +var count = 0 +for (var p in __re){ + if (p==="multiline") { + count++ + } +} + +assert.sameValue(count, 0, 'The value of count is expected to be 0'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A9.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A9.js new file mode 100644 index 0000000000..89a576a978 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/S15.10.7.4_A9.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The RegExp.prototype multiline property does not have the attribute + DontDelete +es5id: 15.10.7.4_A9 +description: Checking if deleting the multiline property succeeds +---*/ + +var __re = RegExp.prototype; + +assert.sameValue(__re.hasOwnProperty('multiline'), true, '__re.hasOwnProperty(\'multiline\') must return true'); +assert.sameValue(delete __re.multiline, true, 'The value of `delete __re.multiline` is expected to be true'); +assert.sameValue(__re.hasOwnProperty('multiline'), false, '__re.hasOwnProperty(\'multiline\') must return false'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/browser.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/browser.js diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/cross-realm.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/cross-realm.js new file mode 100644 index 0000000000..ef0b1bb2e7 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/cross-realm.js @@ -0,0 +1,28 @@ +// 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: A TypeError is thrown when the "this" value is an invalid cross-realm 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. +features: [cross-realm] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get; +var other = $262.createRealm().global; +var otherRegExpProto = other.RegExp.prototype; +var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'multiline').get; + +assert.throws(TypeError, function() { + get.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/multiline/length.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/length.js new file mode 100644 index 0000000000..08105090e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/length.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 21.2.5.7 +description: > + get RegExp.prototype.multiline.length is 0. +info: | + get RegExp.prototype.multiline + + 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] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, "multiline"); + +assert.sameValue(desc.get.length, 0); + +verifyNotEnumerable(desc.get, "length"); +verifyNotWritable(desc.get, "length"); +verifyConfigurable(desc.get, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/name.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/name.js new file mode 100644 index 0000000000..674dec6f70 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 21.2.5.7 +description: > + RegExp.prototype.multiline 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] +---*/ + +var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline'); + +assert.sameValue( + descriptor.get.name, + 'get multiline' +); + +verifyNotEnumerable(descriptor.get, 'name'); +verifyNotWritable(descriptor.get, 'name'); +verifyConfigurable(descriptor.get, 'name'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/shell.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/shell.js diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js new file mode 100644 index 0000000000..f2d3a6e69b --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-invalid-obj.js @@ -0,0 +1,32 @@ +// 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: 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'); + +assert.throws(TypeError, function() { + get.call(() => {}); +}, 'function object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-non-obj.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-non-obj.js new file mode 100644 index 0000000000..4ae30ee5b3 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-non-obj.js @@ -0,0 +1,43 @@ +// 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: 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'); + +assert.throws(TypeError, function() { + get.call(4n); +}, 'bigint'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js new file mode 100644 index 0000000000..bbc533b46a --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/multiline/this-val-regexp-prototype.js @@ -0,0 +1,19 @@ +// 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); + +reportCompare(0, 0); |