summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/unicode
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/RegExp/prototype/unicode
parentInitial commit. (diff)
downloadfirefox-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/unicode')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/cross-realm.js30
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/length.js30
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/name.js37
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/prop-desc.js17
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js34
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-non-obj.js46
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js19
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp.js27
10 files changed, 240 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/browser.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/browser.js
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/cross-realm.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/cross-realm.js
new file mode 100644
index 0000000000..dd86e4d5ad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/cross-realm.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invoked on a cross-realm object without an [[OriginalFlags]] internal slot
+es6id: 21.2.5.15
+info: |
+ 21.2.5.15 get RegExp.prototype.unicode
+
+ 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, throw a TypeError
+ exception.
+features: [cross-realm]
+---*/
+
+var unicode = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
+var other = $262.createRealm().global;
+var otherRegExpProto = other.RegExp.prototype;
+var otherRegExpGetter = Object.getOwnPropertyDescriptor(otherRegExpProto, 'unicode').get;
+
+assert.throws(TypeError, function() {
+ unicode.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/unicode/length.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/length.js
new file mode 100644
index 0000000000..127e2d0428
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/length.js
@@ -0,0 +1,30 @@
+// 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.15
+description: >
+ "length" property of `unicode` accessor function
+info: |
+ ES6 section 17: 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.
+
+ [...]
+
+ 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 getter = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
+
+assert.sameValue(getter.length, 0);
+
+verifyNotEnumerable(getter, 'length');
+verifyNotWritable(getter, 'length');
+verifyConfigurable(getter, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/name.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/name.js
new file mode 100644
index 0000000000..1e1858b46d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/name.js
@@ -0,0 +1,37 @@
+// 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.15
+description: >
+ "name" property of `unicode` accessor function
+info: |
+ The value of the name property of this function is "get ".
+
+ ES6 section 17:
+
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value is a
+ String.
+
+ [...]
+
+ Functions that are specified as get or set accessor functions of built-in
+ properties have "get " or "set " prepended to the property name string.
+
+ [...]
+
+ Unless otherwise specified, the name property of a built-in
+ Function object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
+
+assert.sameValue(getter.name, 'get unicode');
+
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/prop-desc.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/prop-desc.js
new file mode 100644
index 0000000000..c4c89d7e6e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/prop-desc.js
@@ -0,0 +1,17 @@
+// 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.15
+description: >
+ `unicode` property descriptor
+info: |
+ RegExp.prototype.unicode is an accessor property whose set accessor
+ function is undefined.
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode');
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, 'function');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/shell.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/shell.js
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js
new file mode 100644
index 0000000000..1a8bcb012a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-invalid-obj.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invoked on an object without an [[OriginalFlags]] internal slot
+es6id: 21.2.5.15
+info: |
+ 21.2.5.15 get RegExp.prototype.unicode
+
+ 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, throw a TypeError
+ exception.
+---*/
+
+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');
+
+assert.throws(TypeError, function() {
+ unicode.call(() => {});
+}, 'function object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-non-obj.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-non-obj.js
new file mode 100644
index 0000000000..d5a8130c1a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-non-obj.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `unicode` accessor invoked on a non-object value
+es6id: 21.2.5.15
+info: |
+ 21.2.5.15 get RegExp.prototype.unicode
+
+ 1. Let R be the this value.
+ 2. If Type(R) is not Object, throw a TypeError exception.
+features: [Symbol]
+---*/
+
+var unicode = Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get;
+
+assert.throws(TypeError, function() {
+ unicode.call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ unicode.call(null);
+});
+
+assert.throws(TypeError, function() {
+ unicode.call(true);
+});
+
+assert.throws(TypeError, function() {
+ unicode.call('string');
+});
+
+assert.throws(TypeError, function() {
+ unicode.call(Symbol('s'));
+});
+
+assert.throws(TypeError, function() {
+ unicode.call(4);
+});
+
+assert.throws(TypeError, function() {
+ unicode.call(4n);
+}, 'bigint');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp-prototype.js
new file mode 100644
index 0000000000..4b7d407c00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/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.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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp.js b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp.js
new file mode 100644
index 0000000000..abc61293f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/unicode/this-val-regexp.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `unicode` accessor function invoked on a RegExp instance
+es6id: 21.2.5.15
+info: |
+ 21.2.5.15 get RegExp.prototype.unicode
+
+ [...]
+ 4. Let flags be the value of R’s [[OriginalFlags]] internal slot.
+ 5. If flags contains the code unit "u", return true.
+ 6. Return false.
+---*/
+
+assert.sameValue(/./.unicode, false);
+assert.sameValue(/./i.unicode, false);
+assert.sameValue(/./g.unicode, false);
+assert.sameValue(/./gi.unicode, false);
+
+assert.sameValue(/./u.unicode, true);
+assert.sameValue(/./iu.unicode, true);
+assert.sameValue(/./ug.unicode, true);
+assert.sameValue(/./iug.unicode, true);
+
+reportCompare(0, 0);