-
Mike Pennisi authored
Some tests involving the directive prologue are invalidated by source text transformations that insert executable code in the beginning of the script. Implement a `raw` flag that allows these tests to opt-out of this transformation. Update the relevant tests to use this flag (and remove references to globals only available when code is injected). Update the Python runner accordingly: - Do not run tests marked as "raw" in strict mode - Reject invalid test configurations Update the browser runner accordingly: - Do not modify the script body of tests marked as "raw"
Mike Pennisi authoredSome tests involving the directive prologue are invalidated by source text transformations that insert executable code in the beginning of the script. Implement a `raw` flag that allows these tests to opt-out of this transformation. Update the relevant tests to use this flag (and remove references to globals only available when code is injected). Update the Python runner accordingly: - Do not run tests marked as "raw" in strict mode - Reject invalid test configurations Update the browser runner accordingly: - Do not modify the script body of tests marked as "raw"
Test262 Authoring Guidelines
Test Case Names
Test cases should be created in files that are named to identify the feature or API that's being tested.
Take a look at these examples:
-
Math.fround
handling ofInfinity
:test/built-ins/Math/fround/Math.fround_Infinity.js
-
Array.prototype.find
use withProxy
:test/Array/prototype/find/Array.prototype.find_callable-Proxy-1.js
-
arguments
implements aniterator
interface:test/language/arguments-object/iterator-interface.js
Note The project is currently transitioning from a naming system based on specification section numbers. There remains a substantial number of tests that conform to this outdated convention; contributors should ignore that approach when introducing new tests and instead encode this information using the es5id or es6id frontmatter tags.
Test Case Style
A test file has three sections: Copyright, Frontmatter, and Body. A test looks roughly like this:
// Copyright (C) 2015 [Contributor Name]. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: brief description
info: >
verbose test description, multiple lines OK.
(this is rarely necessary, usually description is enough)
---*/
[Test Code]
Copyright
The copyright block must be the first section of the test. The copyright block must use //
style comments.
Frontmatter
The Test262 frontmatter is a string of YAML enclosed by the comment start tag /*---
and end tag ---*/
. There must be exactly one Frontmatter per test.
Test262 supports the following tags:
description
description: [string]
This is the only required frontmatter tag. It should be a short, one-line description of the purpose of this testcase. This is the string displayed by the browser runnner.
Eg: Insert <LS> between chunks of one string