Update all harness files to pass linting. (#1153)

```
$ python tools/lint/lint.py --whitelist lint.whitelist harness/*.js
Linting 25 files.
Linting complete. 0 errors found.
```

- Renames detachArrayBuffer-$262.detachArrayBuffer.js -> detachArrayBuffer-host-detachArrayBuffer.js (previous naming prevents command-click from terminal)

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This commit is contained in:
Rick Waldron 2017-07-14 11:37:24 -04:00 committed by Leo Balter
parent 69b889150d
commit 4ea2931f16
28 changed files with 186 additions and 45 deletions

View File

@ -1,6 +1,11 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Verify that a subArray is contained within an array.
---*/
/** /**
* Verify that a subArray is contained within an array.
*
* @param {Array} array * @param {Array} array
* @param {Array} subArray * @param {Array} subArray
*/ */

View File

@ -1,3 +1,10 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of assertion functions used throughout test262
---*/
function assert(mustBeTrue, message) { function assert(mustBeTrue, message) {
if (mustBeTrue === true) { if (mustBeTrue === true) {
return; return;

View File

@ -1,10 +1,13 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved. // Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Verify that the given date object's Number representation describes the
correct number of milliseconds since the Unix epoch relative to the local
time zone (as interpreted at the specified date).
---*/
/** /**
* Verify that the given date object's Number representation describes the
* correct number of milliseconds since the Unix epoch relative to the local
* time zone (as interpreted at the specified date).
*
* @param {Date} date * @param {Date} date
* @param {Number} expectedMs * @param {Number} expectedMs
*/ */

View File

@ -1,4 +1,9 @@
// The amount of slack allowed for testing time-related Atomics methods (i.e. // Copyright (C) 2017 Ecma International. All rights reserved.
// wait and wake). The absolute value of the difference of the observed time // This code is governed by the BSD license found in the LICENSE file.
// and the expected time must be epsilon-close. /*---
description: |
The amount of slack allowed for testing time-related Atomics methods (i.e.
wait and wake). The absolute value of the difference of the observed time
and the expected time must be epsilon-close.
---*/
var $ATOMICS_MAX_TIME_EPSILON = 100; var $ATOMICS_MAX_TIME_EPSILON = 100;

View File

@ -1,13 +1,13 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved. // Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
/** description: |
* Provide a list for original and expected values for different byte Provide a list for original and expected values for different byte
* conversions. conversions.
* This helper is mostly used on tests for TypedArray and DataView, and each This helper is mostly used on tests for TypedArray and DataView, and each
* array from the expected values must match the original values array on every array from the expected values must match the original values array on every
* index containing its original value. index containing its original value.
*/ ---*/
var byteConversionValues = { var byteConversionValues = {
values: [ values: [
127, // 2 ** 7 - 1 127, // 2 ** 7 - 1

View File

@ -1,5 +1,10 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Compare the contents of two arrays
---*/
//-----------------------------------------------------------------------------
function compareArray(a, b) { function compareArray(a, b) {
if (b.length !== a.length) { if (b.length !== a.length) {
return false; return false;
@ -16,4 +21,4 @@ function compareArray(a, b) {
assert.compareArray = function(actual, expected, message) { assert.compareArray = function(actual, expected, message) {
assert(compareArray(actual, expected), assert(compareArray(actual, expected),
`Expected [${actual.join(", ")}] and [${expected.join(", ")}] to have the same contents. ${message}`); `Expected [${actual.join(", ")}] and [${expected.join(", ")}] to have the same contents. ${message}`);
} };

View File

@ -1,5 +1,9 @@
// Copyright (C) 2009 the Sputnik authors. All rights reserved. // Copyright (C) 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of date-centric values
---*/
var date_1899_end = -2208988800001; var date_1899_end = -2208988800001;
var date_1900_start = -2208988800000; var date_1900_start = -2208988800000;

View File

@ -1,5 +1,9 @@
// Copyright (C) 2017 André Bargull. All rights reserved. // Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of functions used to assert the correctness of various encoding operations.
---*/
function decimalToHexString(n) { function decimalToHexString(n) {
var hex = "0123456789ABCDEF"; var hex = "0123456789ABCDEF";

View File

@ -1,3 +1,13 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
A function used in the process of asserting correctness of TypedArray objects.
$262.detachArrayBuffer is defined by a host.
---*/
function $DETACHBUFFER(buffer) { function $DETACHBUFFER(buffer) {
if (!$262 || typeof $262.detachArrayBuffer !== "function") { if (!$262 || typeof $262.detachArrayBuffer !== "function") {
throw new Test262Error("No method available to detach an ArrayBuffer"); throw new Test262Error("No method available to detach an ArrayBuffer");

View File

@ -1,3 +1,10 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
---*/
function __consolePrintHandle__(msg){ function __consolePrintHandle__(msg){
print(msg); print(msg);
} }

View File

@ -1,4 +1,10 @@
//----------------------------------------------------------------------------- // Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Produce a reliable global object
---*/
var __globalObject = Function("return this;")(); var __globalObject = Function("return this;")();
function fnGlobalObject() { function fnGlobalObject() {
return __globalObject; return __globalObject;

View File

@ -1,9 +1,12 @@
/** // Copyright (C) 2017 Ecma International. All rights reserved.
* A collection of NaN values produced from expressions that have been observed // This code is governed by the BSD license found in the LICENSE file.
* to create distinct bit representations on various platforms. These provide a /*---
* weak basis for assertions regarding the consistent canonicalization of NaN description: |
* values in Array buffers. A collection of NaN values produced from expressions that have been observed
*/ to create distinct bit representations on various platforms. These provide a
weak basis for assertions regarding the consistent canonicalization of NaN
values in Array buffers.
---*/
var distinctNaNs = [ var distinctNaNs = [
0/0, Infinity/Infinity, -(0/0), Math.pow(-1, 0.5), -Math.pow(-1, 0.5) 0/0, Infinity/Infinity, -(0/0), Math.pow(-1, 0.5), -Math.pow(-1, 0.5)
]; ];

View File

@ -1,5 +1,8 @@
/** // Copyright (C) 2017 Ecma International. All rights reserved.
* This regex makes a best-effort determination that the tested string matches // This code is governed by the BSD license found in the LICENSE file.
* the NativeFunction grammar production without requiring a correct tokeniser. /*---
*/ description: |
This regex makes a best-effort determination that the tested string matches
the NativeFunction grammar production without requiring a correct tokeniser.
---*/
const NATIVE_FUNCTION_RE = /\bfunction\b[\s\S]*\([\s\S]*\)[\s\S]*\{[\s\S]*\[[\s\S]*\bnative\b[\s\S]+\bcode\b[\s\S]*\][\s\S]*\}/; const NATIVE_FUNCTION_RE = /\bfunction\b[\s\S]*\([\s\S]*\)[\s\S]*\{[\s\S]*\[[\s\S]*\bnative\b[\s\S]+\bcode\b[\s\S]*\][\s\S]*\}/;

View File

@ -1,4 +1,13 @@
//----------------------------------------------------------------------------- // Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Check that an array contains a numeric sequence starting at 1
and incrementing by 1 for each entry in the array. Used by
Promise tests to assert the order of execution in deep Promise
resolution pipelines.
---*/
function checkSequence(arr, message) { function checkSequence(arr, message) {
arr.forEach(function(e, i) { arr.forEach(function(e, i) {
if (e !== (i+1)) { if (e !== (i+1)) {

View File

@ -1,3 +1,10 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of functions used to safely verify the correctness of
property descriptors.
---*/
function verifyProperty(obj, name, desc, options) { function verifyProperty(obj, name, desc, options) {
assert( assert(

View File

@ -1,3 +1,11 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Used to assert the correctness of object behavior in the presence
and context of Proxy objects.
---*/
function allowProxyTraps(overrides) { function allowProxyTraps(overrides) {
function throwTest262Error(msg) { function throwTest262Error(msg) {
return function () { throw new Test262Error(msg); }; return function () { throw new Test262Error(msg); };

View File

@ -1,3 +1,10 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of functions used to assert the correctness of RegExp objects.
---*/
function buildString({ loneCodePoints, ranges }) { function buildString({ loneCodePoints, ranges }) {
const CHUNK_SIZE = 10000; const CHUNK_SIZE = 10000;
let result = String.fromCodePoint(...loneCodePoints); let result = String.fromCodePoint(...loneCodePoints);

View File

@ -1,5 +1,12 @@
// Copyright (C) 2016 ecmascript_simd authors. All rights reserved. // Copyright (C) 2016 ecmascript_simd authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of functions used to assert the correctness of SIMD objects.
No longer used in any tests.
---*/
function minNum(x, y) { function minNum(x, y) {
return x != x ? y : return x != x ? y :

View File

@ -1,5 +1,13 @@
/// Copyright (c) 2012 Ecma International. All rights reserved. // Copyright (c) 2012 Ecma International. All rights reserved.
/// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Provides both:
- An error class to avoid false positives when testing for thrown exceptions
- A function to explicitly throw an exception using the Test262Error class
---*/
function Test262Error(message) { function Test262Error(message) {
this.message = message || ""; this.message = message || "";

View File

@ -1,4 +1,13 @@
// This defines the number of consecutive recursive function calls that must be // Copyright (C) 2015 André Bargull. All rights reserved.
// made in order to prove that stack frames are properly destroyed according to // This code is governed by the BSD license found in the LICENSE file.
// ES2015 tail call optimization semantics. /*---
description: |
This defines the number of consecutive recursive function calls that must be
made in order to prove that stack frames are properly destroyed according to
ES2015 tail call optimization semantics.
---*/
var $MAX_ITERATIONS = 100000; var $MAX_ITERATIONS = 100000;

View File

@ -1,5 +1,10 @@
// Copyright (C) 2017 Mozilla Corporation. All rights reserved. // Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of functions used to assert the correctness of SharedArrayBuffer objects.
---*/
/** /**
* Calls the provided function for a each bad index that should throw a * Calls the provided function for a each bad index that should throw a

View File

@ -1,5 +1,9 @@
// Copyright 2012 Mozilla Corporation. All rights reserved. // Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
A function used to assert the correctness of built-in objects.
---*/
/** /**
* @description Tests that obj meets the requirements for built-in objects * @description Tests that obj meets the requirements for built-in objects

View File

@ -1,11 +1,14 @@
// Copyright 2011-2012 Norbert Lindenberg. All rights reserved. // Copyright (C) 2011 2012 Norbert Lindenberg. All rights reserved.
// Copyright 2012-2013 Mozilla Corporation. All rights reserved. // Copyright (C) 2012 2013 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
This file contains shared functions for the tests in the conformance test
suite for the ECMAScript Internationalization API.
author: Norbert Lindenberg
---*/
/** /**
* This file contains shared functions for the tests in the conformance test
* suite for the ECMAScript Internationalization API.
* @author Norbert Lindenberg
*/ */

View File

@ -1,5 +1,9 @@
// Copyright (C) 2015 André Bargull. All rights reserved. // Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Collection of functions used to assert the correctness of TypedArray objects.
---*/
/** /**
* Array containing every typed array constructor. * Array containing every typed array constructor.

View File

@ -1,3 +1,9 @@
// Copyright (C) 2017 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Used in website/scripts/sth.js
---*/
//setTimeout is not available, hence this script was loaded //setTimeout is not available, hence this script was loaded
if (Promise === undefined && this.setTimeout === undefined) { if (Promise === undefined && this.setTimeout === undefined) {
if(/\$DONE()/.test(code)) if(/\$DONE()/.test(code))

View File

@ -1,4 +1,4 @@
// Copyright (c) 2017 Rick Waldron. All rights reserved. // Copyright (C) 2017 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---

View File

@ -6,7 +6,7 @@ description: >
$DETACHBUFFER $DETACHBUFFER
$DETACHBUFFER relies on the presence of a definition for $262.detachArrayBuffer $DETACHBUFFER relies on the presence of a host definition for $262.detachArrayBuffer
includes: [detachArrayBuffer.js,sta.js] includes: [detachArrayBuffer.js,sta.js]
---*/ ---*/
@ -14,7 +14,8 @@ includes: [detachArrayBuffer.js,sta.js]
var $262 = { var $262 = {
detachArrayBuffer() { detachArrayBuffer() {
throw new Test262Error('$262.detachArrayBuffer called.'); throw new Test262Error('$262.detachArrayBuffer called.');
} },
destroy() {}
}; };
var ab = new ArrayBuffer(1); var ab = new ArrayBuffer(1);

View File

@ -7,9 +7,10 @@ description: >
$DETACHBUFFER $DETACHBUFFER
$DETACHBUFFER relies on the presence of a definition for $262.detachArrayBuffer. $DETACHBUFFER relies on the presence of a definition for $262.detachArrayBuffer.
Without a definition, calling $DETACHBUFFER will result in a ReferenceError Without a definition, calling $DETACHBUFFER will result in a ReferenceError
includes: [detachArrayBuffer.js,sta.js] includes: [sta.js]
---*/ ---*/
var ab = new ArrayBuffer(1); var ab = new ArrayBuffer(1);