Here are some of the standard tests for property metadata of the
Array.fromAsync property and for the built-in function object. These don't
require doing anything asynchronously, so can be considered separately
from the Async Helpers RFC.
While we're at it, use assert() instead of assert.sameValue() for brevity,
if we are not specifically testing that the return value of hasOwnProperty
is the value true or false; and add more informative assertion messages to
help with debugging.
In some cases, the Object.hasOwnProperty.call could be replaced with
verifyProperty(), if the property descriptor was also being verified at
the same time.
This fixes some tests that were faulty to begin with: a common mistake was
Object.hasOwnProperty(obj, prop) which is probably going to return false
when that's not what you want.
The only instances left of `Object.hasOwnProperty` are one regression test
in implementation-contributed which I can't tell if it was intentionally
needed to trigger the regression, and a few instances of
`Object.hasOwnProperty('prototype')` which would defeat the purpose to
convert into `Object.prototype.hasOwnProperty.call(Object, 'prototype')`
form.
Closes: #3524
Includes key should use flow notation to be able parsed easier
as suggested in https://github.com/tc39/test262/issues/1997
Added this check to the linting script and updated tests accordingly.
Prior to this patch, the tests for certain Array prototype methods
incorrectly expected all elements to be "visited" even when a given
property was not present according to HasProperty.
Update the tests to reflect the fact that under such conditions, the
removed element is not visited.
A number of tests were found to be duplicative based on an analysis of
file contents (included below). Eliminate the duplication by removing
the version of each test with less precise metadata. In cases where this
removal could technically be considered a reduction in coverage,
preserve the verification of additional semantics in the remaining test.
$ git grep -El 'new\s+\w+.prototype' | sed 's/[^\/]\+$//g' | sort | uniq -c | grep -vE '^\s+1 ' | awk '{print $2}' | xargs grep -Elr 'new\s+\w+.prototype'
test/built-ins/Array/prototype/join/S15.4.4.5_A6.7.js
test/built-ins/Array/prototype/join/not-a-constructor.js
test/built-ins/Array/prototype/pop/not-a-constructor.js
test/built-ins/Array/prototype/pop/S15.4.4.6_A5.7.js
test/built-ins/Array/prototype/push/S15.4.4.7_A6.7.js
test/built-ins/Array/prototype/push/not-a-constructor.js
test/built-ins/Array/prototype/shift/not-a-constructor.js
test/built-ins/Array/prototype/shift/S15.4.4.9_A5.7.js
test/built-ins/Array/prototype/slice/not-a-constructor.js
test/built-ins/Array/prototype/slice/S15.4.4.10_A5.7.js
test/built-ins/Array/prototype/sort/not-a-constructor.js
test/built-ins/Array/prototype/sort/S15.4.4.11_A7.7.js
test/built-ins/Array/prototype/splice/S15.4.4.12_A5.7.js
test/built-ins/Array/prototype/splice/not-a-constructor.js
test/built-ins/Array/prototype/toLocaleString/S15.4.4.3_A4.7.js
test/built-ins/Array/prototype/toLocaleString/not-a-constructor.js
test/built-ins/Array/prototype/toString/S15.4.4.2_A4.7.js
test/built-ins/Array/prototype/toString/not-a-constructor.js
test/built-ins/Array/prototype/unshift/S15.4.4.13_A5.7.js
test/built-ins/Array/prototype/unshift/not-a-constructor.js
test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js
test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js
test/built-ins/Function/prototype/apply/not-a-constructor.js
test/built-ins/Function/prototype/call/not-a-constructor.js
test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js
test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js
test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js
test/built-ins/Function/prototype/toString/not-a-constructor.js
test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js
test/built-ins/Object/prototype/hasOwnProperty/not-a-constructor.js
test/built-ins/Object/prototype/propertyIsEnumerable/not-a-constructor.js
test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js
test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js
test/built-ins/Object/prototype/toLocaleString/not-a-constructor.js
test/built-ins/Object/prototype/toString/not-a-constructor.js
test/built-ins/Object/prototype/toString/not-ctor.js
test/built-ins/Object/prototype/valueOf/not-a-constructor.js
test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js
The Resizable ArrayBuffer proposal allows implementations to reject any
resize operation, so the tests must accommodate that possibility.
Mitigate the complexity this entails by minimizing branches and by
deferring assertions to locations with shallow call stacks.
Some tests which include function declarations designed to verify
behavior do not reference those functions. Insert the references
necessary for those functions to serve their intended purpose.
This reverts commit b690cb67be, reversing
changes made to 50dd431dff. This is
necessary because the reverted changeset reduced coverage by an unknown
extent.
Prior to this commit, a test for %TypedArray%.prototype.copyWithin
provided a TypedArray instance as the first argument. That argument that
is interpreted as a number, so in relying on the conversion, the test
verified behavior beyond what it purported to test.
Simplify the test by using the desired number value directly, and extend
the tests for type coercion to cover object values.