diff --git a/harness/arrayContains.js b/harness/arrayContains.js index 5f758b933a3876931367d96b7b9250f836620331..d68a42184a0dcb4e903a45abd1341015fbcb5dfe 100644 --- a/harness/arrayContains.js +++ b/harness/arrayContains.js @@ -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} subArray */ diff --git a/harness/assert.js b/harness/assert.js index 1bd3d31fd14e2acbdc4b0d9caa1a615c66b07d53..4f4df41a1a698ed96c0a8d41356f10cd78d9a76a 100644 --- a/harness/assert.js +++ b/harness/assert.js @@ -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) { if (mustBeTrue === true) { return; diff --git a/harness/assertRelativeDateMs.js b/harness/assertRelativeDateMs.js index 20eb4b259cc489901e948a028a326d2f7124d3df..a4ad32c527e33ea3f3539a6865d99c7909071d0f 100644 --- a/harness/assertRelativeDateMs.js +++ b/harness/assertRelativeDateMs.js @@ -1,10 +1,13 @@ // Copyright (C) 2015 the V8 project authors. All rights reserved. // 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 {Number} expectedMs */ diff --git a/harness/atomicsHelper.js b/harness/atomicsHelper.js index 5854a3630dbce318e9873208d4c56085cceb8b51..52650617081a918281fa9bf2d764f0788862d8f5 100644 --- a/harness/atomicsHelper.js +++ b/harness/atomicsHelper.js @@ -1,4 +1,9 @@ -// 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. +// Copyright (C) 2017 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +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; diff --git a/harness/byteConversionValues.js b/harness/byteConversionValues.js index a2074aefcb7d88ca6adc75582423e8beb3ef3973..bc7b9efdb2ad38ea811cdb6cdee5399e6676c609 100644 --- a/harness/byteConversionValues.js +++ b/harness/byteConversionValues.js @@ -1,13 +1,13 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - -/** - * Provide a list for original and expected values for different byte - * conversions. - * 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 - * index containing its original value. - */ +/*--- +description: | + Provide a list for original and expected values for different byte + conversions. + 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 + index containing its original value. +---*/ var byteConversionValues = { values: [ 127, // 2 ** 7 - 1 diff --git a/harness/compareArray.js b/harness/compareArray.js index 228a6aaaecff102929bed408832eb905c2c0928e..44b92ea029c1d3c365e70c6b0e976ca4810e0351 100644 --- a/harness/compareArray.js +++ b/harness/compareArray.js @@ -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) { if (b.length !== a.length) { return false; @@ -16,4 +21,4 @@ function compareArray(a, b) { assert.compareArray = function(actual, expected, message) { assert(compareArray(actual, expected), `Expected [${actual.join(", ")}] and [${expected.join(", ")}] to have the same contents. ${message}`); -} +}; diff --git a/harness/dateConstants.js b/harness/dateConstants.js index ebf2d75e5480aa38920f56ba76717b9592494311..14213b8b5203fea1b00895a46e9525e612b5eb59 100644 --- a/harness/dateConstants.js +++ b/harness/dateConstants.js @@ -1,5 +1,9 @@ // Copyright (C) 2009 the Sputnik authors. All rights reserved. // 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_1900_start = -2208988800000; diff --git a/harness/decimalToHexString.js b/harness/decimalToHexString.js index 36a2bb5b4916362c9319f39f852e8c97bebc2f3f..c531c5f88f256bdd14a31ef921fcab2c52591fbf 100644 --- a/harness/decimalToHexString.js +++ b/harness/decimalToHexString.js @@ -1,5 +1,9 @@ // Copyright (C) 2017 André Bargull. 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 various encoding operations. +---*/ function decimalToHexString(n) { var hex = "0123456789ABCDEF"; diff --git a/harness/detachArrayBuffer.js b/harness/detachArrayBuffer.js index 6e9982e9971e4dc879de4b11db24482023be676e..df526d6627cd8db4c7accff7628ee3ce821fa6a6 100644 --- a/harness/detachArrayBuffer.js +++ b/harness/detachArrayBuffer.js @@ -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) { if (!$262 || typeof $262.detachArrayBuffer !== "function") { throw new Test262Error("No method available to detach an ArrayBuffer"); diff --git a/harness/doneprintHandle.js b/harness/doneprintHandle.js index e5e43821d98593d04b27866563ba21917043ec93..625feef572044bf547ffab1ad07cf4ae35bbbbfb 100644 --- a/harness/doneprintHandle.js +++ b/harness/doneprintHandle.js @@ -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){ print(msg); } diff --git a/harness/fnGlobalObject.js b/harness/fnGlobalObject.js index 9b39cdd9e020021ef19256cbbff2a4ce56f7d55c..1907c25209aa7d28d94380b69c416034925f24fb 100644 --- a/harness/fnGlobalObject.js +++ b/harness/fnGlobalObject.js @@ -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;")(); function fnGlobalObject() { return __globalObject; diff --git a/harness/nans.js b/harness/nans.js index c2392e13280f6544bbd35c0ebb20f3455d264afa..e541dba02ba463159925876e426820c35acb43bd 100644 --- a/harness/nans.js +++ b/harness/nans.js @@ -1,9 +1,12 @@ -/** - * 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. - */ +// Copyright (C) 2017 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + 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 = [ 0/0, Infinity/Infinity, -(0/0), Math.pow(-1, 0.5), -Math.pow(-1, 0.5) ]; diff --git a/harness/nativeFunctionMatcher.js b/harness/nativeFunctionMatcher.js index f902f34141cbed66276e0f97a95dc48268c07e97..0a2d248a350ed737b8967aa09fa8ccb67bd176c1 100644 --- a/harness/nativeFunctionMatcher.js +++ b/harness/nativeFunctionMatcher.js @@ -1,5 +1,8 @@ -/** - * This regex makes a best-effort determination that the tested string matches - * the NativeFunction grammar production without requiring a correct tokeniser. - */ +// Copyright (C) 2017 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +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]*\}/; diff --git a/harness/promiseHelper.js b/harness/promiseHelper.js index 0bdff33e4481088916b516e3ad46e3a9e76fe789..66ae36daf9f70bf522c6e4ac585f0e7d7297e49f 100644 --- a/harness/promiseHelper.js +++ b/harness/promiseHelper.js @@ -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) { arr.forEach(function(e, i) { if (e !== (i+1)) { diff --git a/harness/propertyHelper.js b/harness/propertyHelper.js index 1f04ea7f78863caa951407a372ff716958a4ca18..da69764dc182863eaf74193518af5de441e8057b 100644 --- a/harness/propertyHelper.js +++ b/harness/propertyHelper.js @@ -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) { assert( diff --git a/harness/proxyTrapsHelper.js b/harness/proxyTrapsHelper.js index 402684cfbcaea02c80a994c09d144a36a3373347..a438be9f05c6103c377792075be40b73c9661125 100644 --- a/harness/proxyTrapsHelper.js +++ b/harness/proxyTrapsHelper.js @@ -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 throwTest262Error(msg) { return function () { throw new Test262Error(msg); }; diff --git a/harness/regExpUtils.js b/harness/regExpUtils.js index 2db568ab296c41f0f43abb596af67dde38720fd3..bdb956427ac5b484487ee5330fe6827172491d42 100644 --- a/harness/regExpUtils.js +++ b/harness/regExpUtils.js @@ -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 }) { const CHUNK_SIZE = 10000; let result = String.fromCodePoint(...loneCodePoints); diff --git a/harness/simdUtilities.js b/harness/simdUtilities.js index c8396a77735d2e221ccebc1b805455e15bbf8cee..ba711a5ecb72f35a5def25f2a230bb8bd08b3780 100644 --- a/harness/simdUtilities.js +++ b/harness/simdUtilities.js @@ -1,5 +1,12 @@ // Copyright (C) 2016 ecmascript_simd authors. 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 SIMD objects. + + No longer used in any tests. +---*/ + function minNum(x, y) { return x != x ? y : diff --git a/harness/sta.js b/harness/sta.js index 39fc5b98b688d52d68484b738853effd3baf45e8..341c21e76521407ba1d3410f5d1a3dcb97f18cd6 100644 --- a/harness/sta.js +++ b/harness/sta.js @@ -1,5 +1,13 @@ -/// Copyright (c) 2012 Ecma International. All rights reserved. -/// This code is governed by the BSD license found in the LICENSE file. +// Copyright (c) 2012 Ecma International. All rights reserved. +// 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) { this.message = message || ""; diff --git a/harness/tcoHelper.js b/harness/tcoHelper.js index 5e9bee2257713180fc18d827c4f4d14e9d50e800..ecae61293432231b04bd085a85f342cd3b49071c 100644 --- a/harness/tcoHelper.js +++ b/harness/tcoHelper.js @@ -1,4 +1,13 @@ -// 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. +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +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; diff --git a/harness/testAtomics.js b/harness/testAtomics.js index 2570e3ab814b9044d102008da6356d6acfd25ff0..81f6af3a60226e28a75abd43e02384e3cb13a6c6 100644 --- a/harness/testAtomics.js +++ b/harness/testAtomics.js @@ -1,5 +1,10 @@ // Copyright (C) 2017 Mozilla Corporation. 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 SharedArrayBuffer objects. +---*/ + /** * Calls the provided function for a each bad index that should throw a diff --git a/harness/testBuiltInObject.js b/harness/testBuiltInObject.js index c3ce749825e059e7ab353d602f84a34fbeba5255..c78c0d732ab44d84282b3ee681b66efb696135ec 100644 --- a/harness/testBuiltInObject.js +++ b/harness/testBuiltInObject.js @@ -1,5 +1,9 @@ // Copyright 2012 Mozilla Corporation. All rights reserved. // 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 diff --git a/harness/testIntl.js b/harness/testIntl.js index ddf953acd32afc7838b8c8ec3dbd612bf8a8666e..01315b175e4d8491fb61890519795447cc5dab54 100644 --- a/harness/testIntl.js +++ b/harness/testIntl.js @@ -1,11 +1,14 @@ -// Copyright 2011-2012 Norbert Lindenberg. All rights reserved. -// Copyright 2012-2013 Mozilla Corporation. All rights reserved. +// Copyright (C) 2011 2012 Norbert Lindenberg. 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. +/*--- +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 */ diff --git a/harness/testTypedArray.js b/harness/testTypedArray.js index aece79d8e5808d2ae72060d1584ad2eff5dfe09b..2699214ca358f7eadab04d1085d57234d604d937 100644 --- a/harness/testTypedArray.js +++ b/harness/testTypedArray.js @@ -1,5 +1,9 @@ // Copyright (C) 2015 André Bargull. 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 TypedArray objects. +---*/ /** * Array containing every typed array constructor. diff --git a/harness/timer.js b/harness/timer.js index f1089108beb1e43017ac427c1065dc7db8c6c023..27379398908c381452faaad283182c99e91db0fd 100644 --- a/harness/timer.js +++ b/harness/timer.js @@ -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 if (Promise === undefined && this.setTimeout === undefined) { if(/\$DONE()/.test(code)) diff --git a/test/harness/arrayContains.js b/test/harness/arrayContains.js index 3f83e30878d0040f44198d3a5d0d0250e02bfe4f..bc51ec0f0b812b948b65ab4200364b69aa003ef6 100644 --- a/test/harness/arrayContains.js +++ b/test/harness/arrayContains.js @@ -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. /*--- diff --git a/test/harness/detachArrayBuffer-$262.detachArrayBuffer.js b/test/harness/detachArrayBuffer-host-detachArrayBuffer.js similarity index 88% rename from test/harness/detachArrayBuffer-$262.detachArrayBuffer.js rename to test/harness/detachArrayBuffer-host-detachArrayBuffer.js index 2d1d0a433c47a517d92d54205207a33445293333..2455167567263a5b96990d9bb6f06e4d7678c802 100644 --- a/test/harness/detachArrayBuffer-$262.detachArrayBuffer.js +++ b/test/harness/detachArrayBuffer-host-detachArrayBuffer.js @@ -6,7 +6,7 @@ description: > $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] ---*/ @@ -14,7 +14,8 @@ includes: [detachArrayBuffer.js,sta.js] var $262 = { detachArrayBuffer() { throw new Test262Error('$262.detachArrayBuffer called.'); - } + }, + destroy() {} }; var ab = new ArrayBuffer(1); diff --git a/test/harness/detachArrayBuffer.js b/test/harness/detachArrayBuffer.js index 22d3b6c11a1a6b7ea3142eaac1e8c5297c1b64ff..71eb7dfa01b53c7cb16910896dc4e6fe6282ac03 100644 --- a/test/harness/detachArrayBuffer.js +++ b/test/harness/detachArrayBuffer.js @@ -7,9 +7,10 @@ description: > $DETACHBUFFER $DETACHBUFFER relies on the presence of a definition for $262.detachArrayBuffer. + Without a definition, calling $DETACHBUFFER will result in a ReferenceError -includes: [detachArrayBuffer.js,sta.js] +includes: [sta.js] ---*/ var ab = new ArrayBuffer(1);