Fix CR issues

This commit is contained in:
Wenlu Wang 2021-07-20 16:56:08 +08:00 committed by rwaldron
parent 6a6211e495
commit 74727cd4ed
27 changed files with 110 additions and 86 deletions

View File

@ -4,7 +4,7 @@
esid: sec-array.prototype.findlast esid: sec-array.prototype.findlast
description: > description: >
The range of elements processed is set before the first call to `predicate`. The range of elements processed is set before the first call to `predicate`.
info: | info: |
Array.prototype.findLast ( predicate[ , thisArg ] ) Array.prototype.findLast ( predicate[ , thisArg ] )
... ...

View File

@ -14,6 +14,8 @@ assert.sameValue(
'The value of `Array.prototype.findLast.length` is `1`' 'The value of `Array.prototype.findLast.length` is `1`'
); );
verifyNotEnumerable(Array.prototype.findLast, 'length'); verifyProperty(Array.prototype.findLast, "length", {
verifyNotWritable(Array.prototype.findLast, 'length'); enumerable: false,
verifyConfigurable(Array.prototype.findLast, 'length'); writable: false,
configurable: true
});

View File

@ -4,7 +4,7 @@
esid: sec-array.prototype.findlast esid: sec-array.prototype.findlast
description: > description: >
Array.prototype.findLast.name value and descriptor. Array.prototype.findLast.name value and descriptor.
info: | info: |
Array.prototype.findLast ( predicate [ , thisArg ] ) Array.prototype.findLast ( predicate [ , thisArg ] )
17 ECMAScript Standard Built-in Objects 17 ECMAScript Standard Built-in Objects
@ -18,6 +18,8 @@ assert.sameValue(
'The value of `Array.prototype.findLast.name` is `"findLast"`' 'The value of `Array.prototype.findLast.name` is `"findLast"`'
); );
verifyNotEnumerable(Array.prototype.findLast, 'name'); verifyProperty(Array.prototype.findLast, "name", {
verifyNotWritable(Array.prototype.findLast, 'name'); enumerable: false,
verifyConfigurable(Array.prototype.findLast, 'name'); writable: false,
configurable: true
});

View File

@ -21,7 +21,7 @@ var arr = ['Mike', 'Rick', 'Leo'];
var results = []; var results = [];
arr.findLast(function(kValue, k, O) { arr.findLast(function() {
results.push(arguments); results.push(arguments);
}); });

View File

@ -19,7 +19,7 @@ features: [array-find-from-last]
var result; var result;
[1].findLast(function(kValue, k, O) { [1].findLast(function() {
result = this; result = this;
}); });

View File

@ -19,7 +19,7 @@ features: [array-find-from-last]
var result; var result;
[1].findLast(function(kValue, k, O) { [1].findLast(function() {
result = this; result = this;
}); });

View File

@ -15,6 +15,8 @@ assert.sameValue(
'`typeof Array.prototype.findLast` is `function`' '`typeof Array.prototype.findLast` is `function`'
); );
verifyNotEnumerable(Array.prototype, 'findLast'); verifyProperty(Array.prototype, "findLast", {
verifyWritable(Array.prototype, 'findLast'); enumerable: false,
verifyConfigurable(Array.prototype, 'findLast'); writable: true,
configurable: true
});

View File

@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
var arr = ['Shoes', 'Car', 'Bike']; var arr = ['Shoes', 'Car', 'Bike'];
var called = 0; var called = 0;
var result = arr.findLast(function(val) { var result = arr.findLast(function() {
called++; called++;
return true; return true;
}); });
@ -30,33 +30,33 @@ assert.sameValue(called, 1, 'predicate was called once');
called = 0; called = 0;
result = arr.findLast(function(val) { result = arr.findLast(function(val) {
called++; called++;
return val === 'Bike'; return val === 'Shoes';
}); });
assert.sameValue(called, 1, 'predicate was called three times'); assert.sameValue(called, 3, 'predicate was called three times');
assert.sameValue(result, 'Bike'); assert.sameValue(result, 'Shoes');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return 'string'; return 'string';
}); });
assert.sameValue(result, 'Bike', 'coerced string'); assert.sameValue(result, 'Bike', 'coerced string');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return {}; return {};
}); });
assert.sameValue(result, 'Bike', 'coerced object'); assert.sameValue(result, 'Bike', 'coerced object');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return Symbol(''); return Symbol('');
}); });
assert.sameValue(result, 'Bike', 'coerced Symbol'); assert.sameValue(result, 'Bike', 'coerced Symbol');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return 1; return 1;
}); });
assert.sameValue(result, 'Bike', 'coerced number'); assert.sameValue(result, 'Bike', 'coerced number');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return -1; return -1;
}); });
assert.sameValue(result, 'Bike', 'coerced negative number'); assert.sameValue(result, 'Bike', 'coerced negative number');

View File

@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
var arr = ['Shoes', 'Car', 'Bike']; var arr = ['Shoes', 'Car', 'Bike'];
var called = 0; var called = 0;
var result = arr.findLast(function(val) { var result = arr.findLast(function() {
called++; called++;
return false; return false;
}); });
@ -27,27 +27,27 @@ var result = arr.findLast(function(val) {
assert.sameValue(called, 3, 'predicate was called three times'); assert.sameValue(called, 3, 'predicate was called three times');
assert.sameValue(result, undefined); assert.sameValue(result, undefined);
result = arr.findLast(function(val) { result = arr.findLast(function() {
return ''; return '';
}); });
assert.sameValue(result, undefined, 'coerced string'); assert.sameValue(result, undefined, 'coerced string');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return undefined; return undefined;
}); });
assert.sameValue(result, undefined, 'coerced undefined'); assert.sameValue(result, undefined, 'coerced undefined');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return null; return null;
}); });
assert.sameValue(result, undefined, 'coerced null'); assert.sameValue(result, undefined, 'coerced null');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return 0; return 0;
}); });
assert.sameValue(result, undefined, 'coerced 0'); assert.sameValue(result, undefined, 'coerced 0');
result = arr.findLast(function(val) { result = arr.findLast(function() {
return NaN; return NaN;
}); });
assert.sameValue(result, undefined, 'coerced NaN'); assert.sameValue(result, undefined, 'coerced NaN');

View File

@ -14,6 +14,8 @@ assert.sameValue(
'The value of `Array.prototype.findLastIndex.length` is `1`' 'The value of `Array.prototype.findLastIndex.length` is `1`'
); );
verifyNotEnumerable(Array.prototype.findLastIndex, 'length'); verifyProperty(Array.prototype.findLastIndex, "length", {
verifyNotWritable(Array.prototype.findLastIndex, 'length'); enumerable: false,
verifyConfigurable(Array.prototype.findLastIndex, 'length'); writable: false,
configurable: true
});

View File

@ -18,6 +18,8 @@ assert.sameValue(
'The value of `Array.prototype.findLastIndex.name` is `"findLastIndex"`' 'The value of `Array.prototype.findLastIndex.name` is `"findLastIndex"`'
); );
verifyNotEnumerable(Array.prototype.findLastIndex, 'name'); verifyProperty(Array.prototype.findLastIndex, "name", {
verifyNotWritable(Array.prototype.findLastIndex, 'name'); enumerable: false,
verifyConfigurable(Array.prototype.findLastIndex, 'name'); writable: false,
configurable: true
});

View File

@ -20,7 +20,7 @@ var arr = ['Mike', 'Rick', 'Leo'];
var results = []; var results = [];
arr.findLastIndex(function(kValue, k, O) { arr.findLastIndex(function() {
results.push(arguments); results.push(arguments);
}); });

View File

@ -19,7 +19,7 @@ features: [array-find-from-last]
var result; var result;
[1].findLastIndex(function(kValue, k, O) { [1].findLastIndex(function() {
result = this; result = this;
}); });

View File

@ -19,7 +19,7 @@ features: [array-find-from-last]
var result; var result;
[1].findLastIndex(function(kValue, k, O) { [1].findLastIndex(function() {
result = this; result = this;
}); });

View File

@ -15,6 +15,8 @@ assert.sameValue(
'`typeof Array.prototype.findLastIndex` is `function`' '`typeof Array.prototype.findLastIndex` is `function`'
); );
verifyNotEnumerable(Array.prototype, 'findLastIndex'); verifyProperty(Array.prototype, "findLastIndex", {
verifyWritable(Array.prototype, 'findLastIndex'); enumerable: false,
verifyConfigurable(Array.prototype, 'findLastIndex'); writable: true,
configurable: true
});

View File

@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
var arr = ['Shoes', 'Car', 'Bike']; var arr = ['Shoes', 'Car', 'Bike'];
var called = 0; var called = 0;
var result = arr.findLastIndex(function(val) { var result = arr.findLastIndex(function() {
called++; called++;
return true; return true;
}); });
@ -30,33 +30,33 @@ assert.sameValue(called, 1, 'predicate was called once');
called = 0; called = 0;
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function(val) {
called++; called++;
return val === 'Bike'; return val === 'Shoes';
}); });
assert.sameValue(called, 1, 'predicate was called three times'); assert.sameValue(called, 3, 'predicate was called three times');
assert.sameValue(result, 2); assert.sameValue(result, 0);
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return 'string'; return 'string';
}); });
assert.sameValue(result, 2, 'coerced string'); assert.sameValue(result, 2, 'coerced string');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return {}; return {};
}); });
assert.sameValue(result, 2, 'coerced object'); assert.sameValue(result, 2, 'coerced object');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return Symbol(''); return Symbol('');
}); });
assert.sameValue(result, 2, 'coerced Symbol'); assert.sameValue(result, 2, 'coerced Symbol');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return 1; return 1;
}); });
assert.sameValue(result, 2, 'coerced number'); assert.sameValue(result, 2, 'coerced number');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return -1; return -1;
}); });
assert.sameValue(result, 2, 'coerced negative number'); assert.sameValue(result, 2, 'coerced negative number');

View File

@ -19,7 +19,7 @@ features: [Symbol, array-find-from-last]
var arr = ['Shoes', 'Car', 'Bike']; var arr = ['Shoes', 'Car', 'Bike'];
var called = 0; var called = 0;
var result = arr.findLastIndex(function(val) { var result = arr.findLastIndex(function() {
called++; called++;
return false; return false;
}); });
@ -27,27 +27,27 @@ var result = arr.findLastIndex(function(val) {
assert.sameValue(called, 3, 'predicate was called three times'); assert.sameValue(called, 3, 'predicate was called three times');
assert.sameValue(result, -1); assert.sameValue(result, -1);
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return ''; return '';
}); });
assert.sameValue(result, -1, 'coerced string'); assert.sameValue(result, -1, 'coerced string');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return undefined; return undefined;
}); });
assert.sameValue(result, -1, 'coerced undefined'); assert.sameValue(result, -1, 'coerced undefined');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return null; return null;
}); });
assert.sameValue(result, -1, 'coerced null'); assert.sameValue(result, -1, 'coerced null');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return 0; return 0;
}); });
assert.sameValue(result, -1, 'coerced 0'); assert.sameValue(result, -1, 'coerced 0');
result = arr.findLastIndex(function(val) { result = arr.findLastIndex(function() {
return NaN; return NaN;
}); });
assert.sameValue(result, -1, 'coerced NaN'); assert.sameValue(result, -1, 'coerced NaN');

View File

@ -31,10 +31,10 @@ testWithBigIntTypedArrayConstructors(function(TA) {
called = 0; called = 0;
result = sample.findLast(function(val) { result = sample.findLast(function(val) {
called++; called++;
return val === 62n; return val === 39n;
}); });
assert.sameValue(called, 1, "predicate was called once"); assert.sameValue(called, 3, "predicate was called three times");
assert.sameValue(result, 62n, "returned true on sample[2]"); assert.sameValue(result, 39n, "returned true on sample[0]");
result = sample.findLast(function() { return "string"; }); result = sample.findLast(function() { return "string"; });
assert.sameValue(result, 62n, "ToBoolean(string)"); assert.sameValue(result, 62n, "ToBoolean(string)");

View File

@ -25,6 +25,8 @@ features: [TypedArray, array-find-from-last]
assert.sameValue(TypedArray.prototype.findLast.length, 1); assert.sameValue(TypedArray.prototype.findLast.length, 1);
verifyNotEnumerable(TypedArray.prototype.findLast, "length"); verifyProperty(TypedArray.prototype.findLast, "length", {
verifyNotWritable(TypedArray.prototype.findLast, "length"); enumerable: false,
verifyConfigurable(TypedArray.prototype.findLast, "length"); writable: false,
configurable: true
});

View File

@ -22,6 +22,8 @@ features: [TypedArray, array-find-from-last]
assert.sameValue(TypedArray.prototype.findLast.name, "findLast"); assert.sameValue(TypedArray.prototype.findLast.name, "findLast");
verifyNotEnumerable(TypedArray.prototype.findLast, "name"); verifyProperty(TypedArray.prototype.findLast, "name", {
verifyNotWritable(TypedArray.prototype.findLast, "name"); enumerable: false,
verifyConfigurable(TypedArray.prototype.findLast, "name"); writable: false,
configurable: true
});

View File

@ -14,6 +14,8 @@ features: [TypedArray, array-find-from-last]
var TypedArrayPrototype = TypedArray.prototype; var TypedArrayPrototype = TypedArray.prototype;
verifyNotEnumerable(TypedArrayPrototype, 'findLast'); verifyProperty(TypedArray.prototype, "findLast", {
verifyWritable(TypedArrayPrototype, 'findLast'); enumerable: false,
verifyConfigurable(TypedArrayPrototype, 'findLast'); writable: true,
configurable: true
});

View File

@ -31,10 +31,10 @@ testWithTypedArrayConstructors(function(TA) {
called = 0; called = 0;
result = sample.findLast(function(val) { result = sample.findLast(function(val) {
called++; called++;
return val === 62; return val === 39;
}); });
assert.sameValue(called, 1, "predicate was called once"); assert.sameValue(called, 3, "predicate was called three times");
assert.sameValue(result, 62, "returned true on sample[2]"); assert.sameValue(result, 39, "returned true on sample[0]");
result = sample.findLast(function() { return "string"; }); result = sample.findLast(function() { return "string"; });
assert.sameValue(result, 62, "ToBoolean(string)"); assert.sameValue(result, 62, "ToBoolean(string)");

View File

@ -33,11 +33,11 @@ testWithBigIntTypedArrayConstructors(function(TA) {
called = 0; called = 0;
result = sample.findLastIndex(function(val) { result = sample.findLastIndex(function(val) {
called++; called++;
return val === 9n; return val === 39n;
}); });
assert.sameValue(called, 1, "predicate was called once"); assert.sameValue(called, 3, "predicate was called three times");
assert.sameValue(result, 2, "returned true on sample[2]"); assert.sameValue(result, 0, "returned true on sample[0]");
result = sample.findLastIndex(function() { return "string"; }); result = sample.findLastIndex(function() { return "string"; });
assert.sameValue(result, 2, "ToBoolean(string)"); assert.sameValue(result, 2, "ToBoolean(string)");

View File

@ -25,6 +25,8 @@ features: [TypedArray, array-find-from-last]
assert.sameValue(TypedArray.prototype.findLastIndex.length, 1); assert.sameValue(TypedArray.prototype.findLastIndex.length, 1);
verifyNotEnumerable(TypedArray.prototype.findLastIndex, "length"); verifyProperty(TypedArray.prototype.findLastIndex, "length", {
verifyNotWritable(TypedArray.prototype.findLastIndex, "length"); enumerable: false,
verifyConfigurable(TypedArray.prototype.findLastIndex, "length"); writable: false,
configurable: true
});

View File

@ -22,6 +22,8 @@ features: [TypedArray, array-find-from-last]
assert.sameValue(TypedArray.prototype.findLastIndex.name, "findLastIndex"); assert.sameValue(TypedArray.prototype.findLastIndex.name, "findLastIndex");
verifyNotEnumerable(TypedArray.prototype.findLastIndex, "name"); verifyProperty(TypedArray.prototype.findLastIndex, "name", {
verifyNotWritable(TypedArray.prototype.findLastIndex, "name"); enumerable: false,
verifyConfigurable(TypedArray.prototype.findLastIndex, "name"); writable: false,
configurable: true
});

View File

@ -14,6 +14,8 @@ features: [TypedArray, array-find-from-last]
var TypedArrayPrototype = TypedArray.prototype; var TypedArrayPrototype = TypedArray.prototype;
verifyNotEnumerable(TypedArrayPrototype, 'findLastIndex'); verifyProperty(TypedArray.prototype, "findLastIndex", {
verifyWritable(TypedArrayPrototype, 'findLastIndex'); enumerable: false,
verifyConfigurable(TypedArrayPrototype, 'findLastIndex'); writable: true,
configurable: true
});

View File

@ -33,11 +33,11 @@ testWithTypedArrayConstructors(function(TA) {
called = 0; called = 0;
result = sample.findLastIndex(function(val) { result = sample.findLastIndex(function(val) {
called++; called++;
return val === 9; return val === 39;
}); });
assert.sameValue(called, 1, "predicate was called once"); assert.sameValue(called, 3, "predicate was called three times");
assert.sameValue(result, 2, "returned true on sample[2]"); assert.sameValue(result, 0, "returned true on sample[0]");
result = sample.findLastIndex(function() { return "string"; }); result = sample.findLastIndex(function() { return "string"; });
assert.sameValue(result, 2, "ToBoolean(string)"); assert.sameValue(result, 2, "ToBoolean(string)");