mirror of https://github.com/tc39/test262.git
Fix CR issues
This commit is contained in:
parent
6a6211e495
commit
74727cd4ed
|
@ -4,7 +4,7 @@
|
|||
esid: sec-array.prototype.findlast
|
||||
description: >
|
||||
The range of elements processed is set before the first call to `predicate`.
|
||||
info: |
|
||||
info: |
|
||||
Array.prototype.findLast ( predicate[ , thisArg ] )
|
||||
|
||||
...
|
||||
|
|
|
@ -14,6 +14,8 @@ assert.sameValue(
|
|||
'The value of `Array.prototype.findLast.length` is `1`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.findLast, 'length');
|
||||
verifyNotWritable(Array.prototype.findLast, 'length');
|
||||
verifyConfigurable(Array.prototype.findLast, 'length');
|
||||
verifyProperty(Array.prototype.findLast, "length", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
esid: sec-array.prototype.findlast
|
||||
description: >
|
||||
Array.prototype.findLast.name value and descriptor.
|
||||
info: |
|
||||
info: |
|
||||
Array.prototype.findLast ( predicate [ , thisArg ] )
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
@ -18,6 +18,8 @@ assert.sameValue(
|
|||
'The value of `Array.prototype.findLast.name` is `"findLast"`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.findLast, 'name');
|
||||
verifyNotWritable(Array.prototype.findLast, 'name');
|
||||
verifyConfigurable(Array.prototype.findLast, 'name');
|
||||
verifyProperty(Array.prototype.findLast, "name", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ var arr = ['Mike', 'Rick', 'Leo'];
|
|||
|
||||
var results = [];
|
||||
|
||||
arr.findLast(function(kValue, k, O) {
|
||||
arr.findLast(function() {
|
||||
results.push(arguments);
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [array-find-from-last]
|
|||
|
||||
var result;
|
||||
|
||||
[1].findLast(function(kValue, k, O) {
|
||||
[1].findLast(function() {
|
||||
result = this;
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [array-find-from-last]
|
|||
|
||||
var result;
|
||||
|
||||
[1].findLast(function(kValue, k, O) {
|
||||
[1].findLast(function() {
|
||||
result = this;
|
||||
});
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ assert.sameValue(
|
|||
'`typeof Array.prototype.findLast` is `function`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(Array.prototype, 'findLast');
|
||||
verifyWritable(Array.prototype, 'findLast');
|
||||
verifyConfigurable(Array.prototype, 'findLast');
|
||||
verifyProperty(Array.prototype, "findLast", {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
|
|||
var arr = ['Shoes', 'Car', 'Bike'];
|
||||
var called = 0;
|
||||
|
||||
var result = arr.findLast(function(val) {
|
||||
var result = arr.findLast(function() {
|
||||
called++;
|
||||
return true;
|
||||
});
|
||||
|
@ -30,33 +30,33 @@ assert.sameValue(called, 1, 'predicate was called once');
|
|||
called = 0;
|
||||
result = arr.findLast(function(val) {
|
||||
called++;
|
||||
return val === 'Bike';
|
||||
return val === 'Shoes';
|
||||
});
|
||||
|
||||
assert.sameValue(called, 1, 'predicate was called three times');
|
||||
assert.sameValue(result, 'Bike');
|
||||
assert.sameValue(called, 3, 'predicate was called three times');
|
||||
assert.sameValue(result, 'Shoes');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return 'string';
|
||||
});
|
||||
assert.sameValue(result, 'Bike', 'coerced string');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return {};
|
||||
});
|
||||
assert.sameValue(result, 'Bike', 'coerced object');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return Symbol('');
|
||||
});
|
||||
assert.sameValue(result, 'Bike', 'coerced Symbol');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return 1;
|
||||
});
|
||||
assert.sameValue(result, 'Bike', 'coerced number');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return -1;
|
||||
});
|
||||
assert.sameValue(result, 'Bike', 'coerced negative number');
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
|
|||
var arr = ['Shoes', 'Car', 'Bike'];
|
||||
var called = 0;
|
||||
|
||||
var result = arr.findLast(function(val) {
|
||||
var result = arr.findLast(function() {
|
||||
called++;
|
||||
return false;
|
||||
});
|
||||
|
@ -27,27 +27,27 @@ var result = arr.findLast(function(val) {
|
|||
assert.sameValue(called, 3, 'predicate was called three times');
|
||||
assert.sameValue(result, undefined);
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return '';
|
||||
});
|
||||
assert.sameValue(result, undefined, 'coerced string');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return undefined;
|
||||
});
|
||||
assert.sameValue(result, undefined, 'coerced undefined');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return null;
|
||||
});
|
||||
assert.sameValue(result, undefined, 'coerced null');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return 0;
|
||||
});
|
||||
assert.sameValue(result, undefined, 'coerced 0');
|
||||
|
||||
result = arr.findLast(function(val) {
|
||||
result = arr.findLast(function() {
|
||||
return NaN;
|
||||
});
|
||||
assert.sameValue(result, undefined, 'coerced NaN');
|
||||
|
|
|
@ -14,6 +14,8 @@ assert.sameValue(
|
|||
'The value of `Array.prototype.findLastIndex.length` is `1`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.findLastIndex, 'length');
|
||||
verifyNotWritable(Array.prototype.findLastIndex, 'length');
|
||||
verifyConfigurable(Array.prototype.findLastIndex, 'length');
|
||||
verifyProperty(Array.prototype.findLastIndex, "length", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -18,6 +18,8 @@ assert.sameValue(
|
|||
'The value of `Array.prototype.findLastIndex.name` is `"findLastIndex"`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.findLastIndex, 'name');
|
||||
verifyNotWritable(Array.prototype.findLastIndex, 'name');
|
||||
verifyConfigurable(Array.prototype.findLastIndex, 'name');
|
||||
verifyProperty(Array.prototype.findLastIndex, "name", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ var arr = ['Mike', 'Rick', 'Leo'];
|
|||
|
||||
var results = [];
|
||||
|
||||
arr.findLastIndex(function(kValue, k, O) {
|
||||
arr.findLastIndex(function() {
|
||||
results.push(arguments);
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [array-find-from-last]
|
|||
|
||||
var result;
|
||||
|
||||
[1].findLastIndex(function(kValue, k, O) {
|
||||
[1].findLastIndex(function() {
|
||||
result = this;
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [array-find-from-last]
|
|||
|
||||
var result;
|
||||
|
||||
[1].findLastIndex(function(kValue, k, O) {
|
||||
[1].findLastIndex(function() {
|
||||
result = this;
|
||||
});
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ assert.sameValue(
|
|||
'`typeof Array.prototype.findLastIndex` is `function`'
|
||||
);
|
||||
|
||||
verifyNotEnumerable(Array.prototype, 'findLastIndex');
|
||||
verifyWritable(Array.prototype, 'findLastIndex');
|
||||
verifyConfigurable(Array.prototype, 'findLastIndex');
|
||||
verifyProperty(Array.prototype, "findLastIndex", {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
|
|||
var arr = ['Shoes', 'Car', 'Bike'];
|
||||
var called = 0;
|
||||
|
||||
var result = arr.findLastIndex(function(val) {
|
||||
var result = arr.findLastIndex(function() {
|
||||
called++;
|
||||
return true;
|
||||
});
|
||||
|
@ -30,33 +30,33 @@ assert.sameValue(called, 1, 'predicate was called once');
|
|||
called = 0;
|
||||
result = arr.findLastIndex(function(val) {
|
||||
called++;
|
||||
return val === 'Bike';
|
||||
return val === 'Shoes';
|
||||
});
|
||||
|
||||
assert.sameValue(called, 1, 'predicate was called three times');
|
||||
assert.sameValue(result, 2);
|
||||
assert.sameValue(called, 3, 'predicate was called three times');
|
||||
assert.sameValue(result, 0);
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return 'string';
|
||||
});
|
||||
assert.sameValue(result, 2, 'coerced string');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return {};
|
||||
});
|
||||
assert.sameValue(result, 2, 'coerced object');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return Symbol('');
|
||||
});
|
||||
assert.sameValue(result, 2, 'coerced Symbol');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return 1;
|
||||
});
|
||||
assert.sameValue(result, 2, 'coerced number');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return -1;
|
||||
});
|
||||
assert.sameValue(result, 2, 'coerced negative number');
|
||||
|
|
|
@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
|
|||
var arr = ['Shoes', 'Car', 'Bike'];
|
||||
var called = 0;
|
||||
|
||||
var result = arr.findLastIndex(function(val) {
|
||||
var result = arr.findLastIndex(function() {
|
||||
called++;
|
||||
return false;
|
||||
});
|
||||
|
@ -27,27 +27,27 @@ var result = arr.findLastIndex(function(val) {
|
|||
assert.sameValue(called, 3, 'predicate was called three times');
|
||||
assert.sameValue(result, -1);
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return '';
|
||||
});
|
||||
assert.sameValue(result, -1, 'coerced string');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return undefined;
|
||||
});
|
||||
assert.sameValue(result, -1, 'coerced undefined');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return null;
|
||||
});
|
||||
assert.sameValue(result, -1, 'coerced null');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return 0;
|
||||
});
|
||||
assert.sameValue(result, -1, 'coerced 0');
|
||||
|
||||
result = arr.findLastIndex(function(val) {
|
||||
result = arr.findLastIndex(function() {
|
||||
return NaN;
|
||||
});
|
||||
assert.sameValue(result, -1, 'coerced NaN');
|
||||
|
|
|
@ -31,10 +31,10 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
|||
called = 0;
|
||||
result = sample.findLast(function(val) {
|
||||
called++;
|
||||
return val === 62n;
|
||||
return val === 39n;
|
||||
});
|
||||
assert.sameValue(called, 1, "predicate was called once");
|
||||
assert.sameValue(result, 62n, "returned true on sample[2]");
|
||||
assert.sameValue(called, 3, "predicate was called three times");
|
||||
assert.sameValue(result, 39n, "returned true on sample[0]");
|
||||
|
||||
result = sample.findLast(function() { return "string"; });
|
||||
assert.sameValue(result, 62n, "ToBoolean(string)");
|
||||
|
|
|
@ -25,6 +25,8 @@ features: [TypedArray, array-find-from-last]
|
|||
|
||||
assert.sameValue(TypedArray.prototype.findLast.length, 1);
|
||||
|
||||
verifyNotEnumerable(TypedArray.prototype.findLast, "length");
|
||||
verifyNotWritable(TypedArray.prototype.findLast, "length");
|
||||
verifyConfigurable(TypedArray.prototype.findLast, "length");
|
||||
verifyProperty(TypedArray.prototype.findLast, "length", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -22,6 +22,8 @@ features: [TypedArray, array-find-from-last]
|
|||
|
||||
assert.sameValue(TypedArray.prototype.findLast.name, "findLast");
|
||||
|
||||
verifyNotEnumerable(TypedArray.prototype.findLast, "name");
|
||||
verifyNotWritable(TypedArray.prototype.findLast, "name");
|
||||
verifyConfigurable(TypedArray.prototype.findLast, "name");
|
||||
verifyProperty(TypedArray.prototype.findLast, "name", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -14,6 +14,8 @@ features: [TypedArray, array-find-from-last]
|
|||
|
||||
var TypedArrayPrototype = TypedArray.prototype;
|
||||
|
||||
verifyNotEnumerable(TypedArrayPrototype, 'findLast');
|
||||
verifyWritable(TypedArrayPrototype, 'findLast');
|
||||
verifyConfigurable(TypedArrayPrototype, 'findLast');
|
||||
verifyProperty(TypedArray.prototype, "findLast", {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -31,10 +31,10 @@ testWithTypedArrayConstructors(function(TA) {
|
|||
called = 0;
|
||||
result = sample.findLast(function(val) {
|
||||
called++;
|
||||
return val === 62;
|
||||
return val === 39;
|
||||
});
|
||||
assert.sameValue(called, 1, "predicate was called once");
|
||||
assert.sameValue(result, 62, "returned true on sample[2]");
|
||||
assert.sameValue(called, 3, "predicate was called three times");
|
||||
assert.sameValue(result, 39, "returned true on sample[0]");
|
||||
|
||||
result = sample.findLast(function() { return "string"; });
|
||||
assert.sameValue(result, 62, "ToBoolean(string)");
|
||||
|
|
|
@ -33,11 +33,11 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
|||
called = 0;
|
||||
result = sample.findLastIndex(function(val) {
|
||||
called++;
|
||||
return val === 9n;
|
||||
return val === 39n;
|
||||
});
|
||||
|
||||
assert.sameValue(called, 1, "predicate was called once");
|
||||
assert.sameValue(result, 2, "returned true on sample[2]");
|
||||
assert.sameValue(called, 3, "predicate was called three times");
|
||||
assert.sameValue(result, 0, "returned true on sample[0]");
|
||||
|
||||
result = sample.findLastIndex(function() { return "string"; });
|
||||
assert.sameValue(result, 2, "ToBoolean(string)");
|
||||
|
|
|
@ -25,6 +25,8 @@ features: [TypedArray, array-find-from-last]
|
|||
|
||||
assert.sameValue(TypedArray.prototype.findLastIndex.length, 1);
|
||||
|
||||
verifyNotEnumerable(TypedArray.prototype.findLastIndex, "length");
|
||||
verifyNotWritable(TypedArray.prototype.findLastIndex, "length");
|
||||
verifyConfigurable(TypedArray.prototype.findLastIndex, "length");
|
||||
verifyProperty(TypedArray.prototype.findLastIndex, "length", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -22,6 +22,8 @@ features: [TypedArray, array-find-from-last]
|
|||
|
||||
assert.sameValue(TypedArray.prototype.findLastIndex.name, "findLastIndex");
|
||||
|
||||
verifyNotEnumerable(TypedArray.prototype.findLastIndex, "name");
|
||||
verifyNotWritable(TypedArray.prototype.findLastIndex, "name");
|
||||
verifyConfigurable(TypedArray.prototype.findLastIndex, "name");
|
||||
verifyProperty(TypedArray.prototype.findLastIndex, "name", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -14,6 +14,8 @@ features: [TypedArray, array-find-from-last]
|
|||
|
||||
var TypedArrayPrototype = TypedArray.prototype;
|
||||
|
||||
verifyNotEnumerable(TypedArrayPrototype, 'findLastIndex');
|
||||
verifyWritable(TypedArrayPrototype, 'findLastIndex');
|
||||
verifyConfigurable(TypedArrayPrototype, 'findLastIndex');
|
||||
verifyProperty(TypedArray.prototype, "findLastIndex", {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -33,11 +33,11 @@ testWithTypedArrayConstructors(function(TA) {
|
|||
called = 0;
|
||||
result = sample.findLastIndex(function(val) {
|
||||
called++;
|
||||
return val === 9;
|
||||
return val === 39;
|
||||
});
|
||||
|
||||
assert.sameValue(called, 1, "predicate was called once");
|
||||
assert.sameValue(result, 2, "returned true on sample[2]");
|
||||
assert.sameValue(called, 3, "predicate was called three times");
|
||||
assert.sameValue(result, 0, "returned true on sample[0]");
|
||||
|
||||
result = sample.findLastIndex(function() { return "string"; });
|
||||
assert.sameValue(result, 2, "ToBoolean(string)");
|
||||
|
|
Loading…
Reference in New Issue