Commit Graph

173 Commits

Author SHA1 Message Date
Rick Waldron c9f3ab5610 Temp renaming to get around case ignorance, part 2
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:59 -04:00
Rick Waldron 86209d8fd9 Make all harness/* file names consistent; update occurrences in test
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:58 -04:00
Rick Waldron 2086f66c55 Update verifyProperty to allow checking `value`
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-23 11:58:16 -04:00
Leo Balter 666f0e920a
Add assert.throws.early 2017-05-01 12:29:52 -04:00
Daniel Ehrenberg abac4e0b19
Fix up compareArray 2017-04-27 19:33:41 -04:00
Daniel Ehrenberg 8cb7f59395
Create an assert.compareArray
This is a convenience function which tries to make tests easier
to read and write.
2017-04-27 19:33:40 -04:00
André Bargull 94f6003d11 Optimize decodeURI/encodeURI tests (#987)
* Move decimalToHexString into harness instead of duplicating it in multiple files

* Optimize decimalToHexString and support numbers greater than 65535

* Replace alternative decimalToHexString function with include for decimalToHexString.js

* Add decimalToHex2String to return the string representation of a two-digit hex-number

* Replace decimalToHex2String with decimalToPercentHexString to return the percent hex-encoded string of a two-digit hex-number

* Replace two String.fromCharCode calls with a single call

* Further reduce string concatentations in decodeURI[Component] tests

* Remove unnecessary Test262Error error handling in catch-clauses

* Remove try/catch wrappings in decodeURI/encodeURI tests
2017-04-18 16:31:31 -04:00
Leo Balter e43ce56105 Add Verify Property harness (#979) 2017-04-15 12:56:29 -04:00
André Bargull 1ba3a7c4a9 Remove unused functionality from harness (#975) 2017-04-14 12:22:27 -04:00
André Bargull d59e30c95e Remove execute bit from files (#976) 2017-04-13 16:24:07 -04:00
Mathias Bynens 44b40e083e Add exhaustive tests for RegExp Unicode property escapes (#971)
Proposal: https://github.com/tc39/proposal-regexp-unicode-property-escapes

These tests have been generated by the script at https://github.com/mathiasbynens/unicode-property-escapes-tests. They check all the properties and values that should be supported by implementations against the symbols they’re supposed to match. False positives are detected as well.

Ref. #950.
Ref. https://github.com/tc39/proposal-regexp-unicode-property-escapes/issues/4.
2017-04-13 11:22:49 -04:00
Mathias Bynens a621155bcd Unify indentation and add .editorconfig (#973) 2017-04-13 10:37:32 -04:00
Leo Balter 866d7f8d8e Improve isEnumerable check with a for-in loop for string names (#880)
Ref https://github.com/tc39/test262/pull/879#discussion_r104128520
2017-03-13 10:48:33 -07:00
Lars T Hansen abc4dfae42 Account for the use of ToIndex in Atomic operations (#870)
Ref tc39/ecma262#807
2017-03-02 13:21:14 -05:00
Rick Waldron fdd2fa9b1c Rename $ => $262. Fixes gh-802 (#823)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-03-01 16:34:15 -05:00
Shu-yu Guo a72ee6d912 SharedArrayBuffer and Atomics tests (#839) 2017-02-07 11:17:31 -05:00
Kevin Gibbons abf6489b29 use $.detachArrayBuffer API instead of throwing (#795) 2016-11-22 17:13:23 -05:00
Mike Pennisi ade6d2e384 Remove "NotEarlyError" object
Because expectations regarding error "phase" are now expressed via test
meta-data, the test runner may now enforce this requirement on negative
tests.

Remove the "NotEarlyError" from the project source. This reduces the
amount of domain knowledge required to author tests and lessens the
potential for inconsistencies between tests.
2016-10-19 15:24:22 -04:00
Leonardo Balter 813bb5166c
Remove precision-equivalency tests
Due to specs approximation values, some tests are invalid as the harness
helpers rely on another approximated values as Math.LN2.
2016-06-20 17:44:11 -04:00
Leonardo Balter bc42c6ab5c Add harness for byte conversion values
Update testTypedArrayConversions to require byteConversionValues
2016-05-25 10:10:50 -04:00
jugglinmike b17ffc0298 Add tests for NaN handling with Typed Arrays (#623)
Ensure that NaN values are canonicalized consistently by all invocations
of SetValueInBuffer. Also ensure that `%TypedArray%.prototype.set` and
`%TypedArray%.prototype.slice` preserve the bit-level encoding of the
source data.

Use a set of experimentally-derived expressions known to produce NaN
values with distinct bit patterns in various platforms.
2016-05-12 10:16:03 -04:00
Gorkem Yakin f6475d81bf Merge pull request #543 from bocoup/enumerable-helper
Fix verifyEnumerable helper to account for properties with Symbol values
2016-04-25 16:32:53 -07:00
jugglinmike ba3dacbe5a Correct tests for native functions' toString value (#580)
Modify the regular expression for native functions' toString value to
satisfy all test cases. Correct the test file's reference to the harness
file. Re-format the test file's assertions to aid debugging in the event
of failure.
2016-04-21 15:55:54 -04:00
jugglinmike cf68c3be91 Correct invalid tests for the Date constructor
The millisecond representation of a given Date instance is dependent on
the local system's time zone settings. In order to pass consistently
across contexts, tests for this value must take the system configuration
into account.

Introduce a test harness utility function to encapsulate these concerns.
Re-use this function across all test files that assert the exact
millisecond representation of Date instances.
2016-04-19 17:00:59 -04:00
Leonardo Balter 04a3c28f7d Add tests for conversion operations on TypedArrays 2016-04-19 12:18:52 -04:00
dtig 20d37a6f2f Add SIMD test suite and utility functions (#442) 2016-04-18 14:26:15 -04:00
Leonardo Balter e7f6cd7f86 assert.throws fails if second argument is not a function 2016-04-15 10:14:54 -04:00
Michael Ficarra 6b7cbb5035 add Function.prototype.toString tests, conforming to proposed revision
See the proposal at
https://tc39.github.io/Function-prototype-toString-revision/
2016-04-11 14:39:12 -04:00
Leonardo Balter 70c7375be8 Add harness/detachArrayBuffer.js 2016-03-22 17:00:01 -04:00
Leonardo Balter a93ef42b56 Fix verifyEnumerable helper to account for Symbol properties 2016-03-15 10:13:52 -04:00
Jordan Harband a6fad62d7c Last minute fixes 2016-02-19 11:27:31 -08:00
Jordan Harband 6f05b008dc Encapsulate helper function's helper function 2016-02-17 15:01:26 -08:00
Jordan Harband d530c87b41 Create `proxyTrapsHelper` to throw on all traps by default. 2016-02-13 15:56:47 -08:00
Gorkem Yakin dbcc8cadf3 Merge pull request #507 from bocoup/remove-unused-file
Remove unused harness file
2016-02-12 17:16:01 -08:00
Leonardo Balter 4388f2869c Allow call testWithTypedArrayConstructors with a constructors subset 2016-02-12 16:02:36 -08:00
Mike Pennisi 071b5f03c6 Remove unused harness file
The harness file `Test262Error.js` has not contained executable code since it
was introduced in this project [1]. The definition of the `Test262Error`
function has consistently been located in the `sta.js` harness file which test
runners are expected to inject into the test environment.

Remove the file and all references to it.

[1] See commit c33bf0e043
2016-02-12 13:44:18 -05:00
Mike Pennisi 4dc81d3788 Add tests for tail-call optimization
ECMAScript 2015 introduced tail call optimization for function calls
occuring in a number of positions in the grammar. Assert expected
behavior by triggering a large (but configurable) number of recursive
function calls in these positions. Compliant runtimes will execute such
programs without error; non-compliant runtimes are expected to fail
these tests by throwing an error or crashing when system resources are
exhausted.
2016-02-01 13:20:17 -05:00
André Bargull 42edfd6e89 Add missing tests for "length" and "name" properties of %TypedArray% built-in functions 2016-01-15 18:12:42 +01:00
André Bargull b62dccf1dc Add test cases for recent ES2016 fixes
- lastIndex in RegExp.prototype[Symbol.split]: tc39/ecma262@08b4756747
- Missing number conversion in DataView.prototype.setXXX: tc39/ecma262@4f875fe96d
- Negative zero byteoffset in TypedArray: tc39/ecma262@2d1ed20db7
- EvalDeclarationInstantiation throws TypeError: tc39/ecma262@2be6968715
- BindingRestElement allows BindingPattern: tc39/ecma262@d322357e6b
- Eval in parameters with computed property keys: tc39/ecma262@04e2e9b719
- Use strict with non-simple parameters: tc39/ecma262@15b0db41ed
- __proto__ in strict mode: tc39/ecma262@5c1984334d
2015-12-15 17:33:49 +01:00
André Bargull 9a3f810465 Remove harness/runTestCase.js 2015-08-13 18:13:45 +02:00
Leonardo Balter e1ec3c29b3 Fix missing variable declaration
Fixes #405
2015-08-05 20:04:02 -04:00
Brian Terlson 8870e7bf34 Merge pull request #394 from smikes/quoted-sameValue-strings
Use guillemets («») to quote string values - fixes #174
2015-08-05 11:20:18 -07:00
smikes 4a6f28f075 Use guillemets («») to quote string values - fixes #174
Expected/actual values should be delimited in a way that
isn't confusable with actual string quotes " '
2015-07-30 20:13:49 -06:00
Brian Terlson eea8807d40 Merge pull request #355 from anba/regexp-unicode
B.1.4 and Unicode RegExps
2015-07-30 15:31:16 -07:00
André Bargull a85f5039e0 Remove links to hg.ecmascript.org 2015-07-17 17:43:09 +02:00
André Bargull d5075819e9 Check resolved time zone is valid 2015-07-08 19:13:55 +02:00
André Bargull a4205bac61 B.1.4 extensions are not allowed for Unicode RegExps 2015-07-08 17:19:59 +02:00
Brian Terlson 20d39432b9 Merge pull request #337 from bocoup/remove-fn-exists
Remove unnecessary "include" file
2015-06-26 11:02:45 -07:00
Brian Terlson 9abed155e3 Merge pull request #338 from bocoup/move-web-scripts
Move web scripts
2015-06-26 10:58:59 -07:00
Brian Terlson 9dc49b72cc Merge pull request #336 from bocoup/remove-env
Remove empty "include" file
2015-06-26 10:57:59 -07:00
Mike Pennisi b974c13751 Move website scripts to a dedicated directory
Some JavaScript source files are only relevant in the context of the
Test262 website. They should not be explicitly included by individual
tests, so their presence in the `harness/` directory alongside "include"
files is misleading.

Move the scripts to a location within the `website/` directory to
better-reflect their intended use. Update the relevant HTML templates
with the new locations.
2015-06-26 13:29:07 -04:00
Mike Pennisi 86c7e272a6 Remove support for legacy `$INCLUDE` syntax
Although test files once expressed dependencies on external files using
a global `$INCLUDE` function, that pattern was removed in favor of
declarative meta-data [1].

Remove the associated logic from the Python runner and the browser.

[1] See commit d4354d14d5.
2015-06-26 13:29:07 -04:00
Mike Pennisi f8e18ccd76 Remove unnecessary "include" file
The `fnExists` function defines a generic way to determine if any number
of values are function instances. Because it is only used by a single
test, the additional complexity required by the generalized code (and
the organizational drawbacks to maintaining another "include" file) are
not justified. Remove the file and update the test to assert the
function's existence directly.
2015-06-26 12:34:04 -04:00
Mike Pennisi e57da7a8f1 Remove empty "include" file
The `environment.js` file has been empty since its initial introduction
to this project [1]. It has no effect on any of the contexts in which it
is currently referenced, so it may be safely removed.

[1] be82787a00
2015-06-26 12:19:51 -04:00
Brian Terlson e4a25da86a Merge pull request #305 from jugglinmike/browser-only-strict
Update browser runner to honor `onlyStrict` flag
2015-06-25 14:44:34 -07:00
Erik Arvidsson 96e5b67cd5 Fix issue with math_precision.js
It was missing vars which was causing issues with our test harness
since we run all the files in strict mode.
2015-06-25 16:43:10 -04:00
Mike Pennisi cb617493d7 Update browser runner to honor `onlyStrict` flag
Unlike the console runner, the browser runner does not modify the
strictness of tests prior to running them. Regardless of a given test's
metadata, it runs every test exactly once, and it never enables strict
mode. This means that tests intended to function in strict mode must
declare the "use strict"; directive prologue in addition to the
`onlyStrict` flag.

For any test that specifies the `onlyStrict` metadata flag, transform
the source code by injecting a "use strict" directive prologue prior to
running the test.
2015-06-18 17:38:33 -04:00
Mike Pennisi 73aa06275a Update browser runner to inject `assert.js`
Since the Python runner was updated to include `assert.js` in all tests
unconditionally, a number of tests have been written that implicitly
rely on its presence. The browser runner does not currently provide this
file's contents to these tests, so they fail unconditionally.

Update the browser runner to inject that file's contents into every test
context.

Note: the existing approach to file retrieval (namely loading via
synchronous XHR requests) is inefficient and deprecated in some
browsers. It is honored here for the sake of consistency and to minimize
the changeset necessary to fix the browser runner.
2015-06-18 13:53:09 -04:00
Mike Pennisi fe11a1ea1a Remove $PRINT helper function
The `$PRINT` helper function has no effect on test behavior. The
following tests use it to report assertion outcomes (and as a result
will fail silently):

- test/language/function-code/S10.2.1_A4_T2.js
- test/language/function-code/S10.2.1_A5.1_T1.js
- test/language/function-code/S10.2.1_A5.1_T2.js
- test/language/function-code/S10.2.1_A5.2_T1.js

Remove the function definition and all references within tests. Update
tests that use it as an error reporting mechanism to instead use an
appropriate `assert` helper function.
2015-06-16 13:43:23 -04:00
Mike Pennisi 92890e6723 Remove `$FAIL` function
This function is equivalent to `$ERROR` (which is automatically included
in test environments). Remove the harness file that defines the
function, remove references to the file from test `includes` lists, and
update scripts to instead invoke the `$ERROR` function.
2015-06-09 19:44:25 -04:00
André Bargull 56036e4064 Enable strict mode for more built-in tests
- Remove no longer needed noStrict flags.
- Change tests to use propertyHelper.js for strict mode compatibility.
- Add tests for return value of `delete` operator, e.g. `delete Array.prototype === false`.
- Add non-writable tests for global NaN property.
- Split some tests to run in strict mode.
- Change tests with global `var length` declaration to use a different variable name for browser environments.
- Merge duplicated tests symbol-data-property-configurable-non-strict and symbol-data-property-configurable-strict.
- Merge duplicated tests symbol-data-property-writable-non-strict and symbol-data-property-writable-strict.
- (And a small change in propertyHelper to reduce code duplication in function call.)
2015-05-18 18:01:00 +02:00
Mike Pennisi 67e9e070ef Correct error messages
The `testBuiltInObject` function verifies the presence of the specified
properties for *all* object types (not just function objects). Update
the error messages to reflect this.
2015-04-21 17:58:10 -04:00
Mike Pennisi c27938a123 Fix bug in `isWritable` utility function
Only attempt to re-set the property value in cases where it was
successfully modified as part of the function's execution. This avoids
errors when the underlying value is not writable. Rename the internal
result-tracking variable to make this more clear.
2015-04-21 15:00:26 -04:00
Mike Pennisi c91267235c Extend assertion error messages
When invoked without a custom assertion message, `assert.sameValue` and
`assert.notSameValue` automatically create a message that describes the
actual and expected values.

Extend both assertion methods to also include this information in cases
where a custom message has been specified.
2015-04-21 13:25:02 -04:00
Brian Terlson fd6f206d69 Merge pull request #194 from arv/function-length-is-configurable
Function length property is configurable
2015-04-08 15:58:30 -07:00
Rick Waldron d797bb979e Import tests from Google V8 (Array.prototype.{fill, find, findIndex}, Array.{from, of})
These tests are derived from the following files within the Google V8 project:

    	test/mjsunit/harmony/array-fill.js
    	test/mjsunit/harmony/array-find.js
    	test/mjsunit/harmony/array-findindex.js
    	test/mjsunit/harmony/array-from.js
    	test/mjsunit/harmony/array-of.js
2015-04-07 09:53:17 -04:00
Erik Arvidsson ad8af4be3a Function length property is configurable
In ES6 the function length property was changed to become
configurable.
2015-03-11 10:42:14 -04:00
Mike Pennisi 9f8f0284c3 Make writability helper function non-destructive
After checking the writability of a given property, restore the property
value to its original state.
2015-03-04 18:43:33 -05:00
smikes 9f884af5cc harness: add checks of descriptor attributes
First check if descriptor is set up correctly, then actually
verify that the attribute (writability, enumerability,
configurability) is as expected.
2015-02-19 18:11:53 -07:00
smikes 65e5aa6f79 fix undefined var 2015-02-14 15:02:49 -07:00
smikes 49abae4f5e rework: remove *PropertyAttributes fns
- this change hits all files that use
dataPropertyAttributesAreCorrect or
acccessorPropertyAttributesAreCorrect

Major changes:
- remove include of runTestCase.js,
dataPropertyAttributesAreCorrect.js and
acccessorPropertyAttributesAreCorrect.js
- add include of propertyHelper.js
- remove function testCase() and call to
function runTestCase()
- instead of collecting test state into booleans,
which are eventually returned from runTestCase,
test conditions and throw errors immediately
- use negative: to check error types instead of
using `instanceof` in a catch() block

Selected commit logs follow:

manual conversion of accessorPropertyAttributesAreCorrect() test
 - remove runTestCase
 - remove wrapping testCase function
 - unindent
 - remove includes of runTestCase & accessor...
 - add include of propertyHelper.js
 - unpack final two args 'true, false' to explicit inline
   tests of isEnumerable and isConfigurable
 - unpack setter test into inline logic
 - unpack getter test into inline logic

used script to replace includes: frontmatter
with propertyHelper.js ; manually added back
references to fnGlobalObject() where needed

additional helper functions

add helper functions for get and writable
duplicate runTestCase so can remove runTestCase.js from
includes of all tests in batch

use keyboard macros to simplify repetitive conversions
remove auto-save file accidentaly committed

minor changes, manually remove runTestCase from remaining files
lint etc. fixes

remove now-obsolete harness files

make strict/nonstrict variants

tests where behavior is different in strict/nonstrict
need two variants

- strict mode throws on assign to read-only element (no setter fn)
- strict mode separates named arguments from arguments[]

fix indentation

cleanup minor issues

reviewing 15.2.3.7-9 tests, found some minor issues

- indentation/spacing
- duplicate test (eg, direct test of value and dataProp...)
- remove needless try/finally
- use assert.. helpers in place of if(is..
- rename some assertions to 'e'

rename assertX to verifyX
new helper fn sameValue
test "set" as well as get
reverse order of checks
restore test of desc2
restore test of length
restore test of ownProperty
incorporate suggestions re order of ops, Object.prototype
add test of sameValue helper
restore return value in getter
restore second defineProperty call
restore check of explicit "false"
restore explicit test of TypeError
set noStrict flag on arguments changes
rename catch var to "e"	b4ad0e6
remove dataPropertyAttributesAreCorrect from tests	0d83ff2
remove accessorPropertyAttributesAreCorrect from tests	bb926f3
remove {data,accessor}Property... fns from harness

fix writable check on array.length

call $ERROR if expected exception not thrown
fix Epected => Expected typo

use assert._isSamevalue
2014-12-10 17:39:16 -08:00
Brian Terlson 1f2f7d062f Move assert helper as well 2014-12-09 13:46:53 -08:00
Brian Terlson 2a74f0ec1b Reorganize ./test 2014-12-07 15:33:09 -08:00