Skip to content

Commit

Permalink
Add cases to RegExp.prototype flags brand checking tests
Browse files Browse the repository at this point in the history
For completeness, as we are doing in newer brand checking tests such as
those of Temporal, call these getters with a function object and a bigint
as the receiver.

Suggested in https://github.com/tc39/test262/pull/3614/files#r929662337
  • Loading branch information
ptomato committed Aug 9, 2022
1 parent 9e51a9d commit d45766b
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
dotAll.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
dotAll.call(() => {});
}, 'function object');
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/dotAll/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
dotAll.call(4);
}, "number");

assert.throws(TypeError, function() {
dotAll.call(4n);
}, "bigint");
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/flags/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(Symbol());
}, 'symbol');

assert.throws(TypeError, function() {
get.call(4n);
}, 'bigint');
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
get.call(() => {});
}, 'function object');
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/global/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(symbol);
}, 'symbol');

assert.throws(TypeError, function() {
get.call(4n);
}, 'bigint');
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
hasIndices.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
hasIndices.call(() => {});
}, 'function object');
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
hasIndices.call(4);
}, "number");

assert.throws(TypeError, function() {
hasIndices.call(4n);
}, "bigint");
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
get.call(() => {});
}, 'function object');
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(symbol);
}, 'symbol');

assert.throws(TypeError, function() {
get.call(4n);
}, 'bigint');
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
get.call(() => {});
}, 'function object');
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/multiline/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(symbol);
}, 'symbol');

assert.throws(TypeError, function() {
get.call(4n);
}, 'bigint');
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
get.call(() => {});
}, 'function object');
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/source/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
get.call(symbol);
}, 'symbol');

assert.throws(TypeError, function() {
get.call(4n);
}, 'bigint');
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
sticky.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
sticky.call(() => {});
}, 'function object');
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/sticky/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
sticky.call(4);
});

assert.throws(TypeError, function() {
sticky.call(4n);
}, 'bigint');
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
unicode.call(arguments);
}, 'arguments object');

assert.throws(TypeError, function() {
unicode.call(() => {});
}, 'function object');
4 changes: 4 additions & 0 deletions test/built-ins/RegExp/prototype/unicode/this-val-non-obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() {
unicode.call(4);
});

assert.throws(TypeError, function() {
unicode.call(4n);
}, 'bigint');

0 comments on commit d45766b

Please sign in to comment.