mirror of https://github.com/tc39/test262.git
Merge pull request #1070 from rwaldron/add-missing-harness-tests
Add missing harness tests
This commit is contained in:
commit
bcea4333fc
|
@ -1,10 +1,16 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
function arrayContains(arr, expected) {
|
||||
/**
|
||||
* Verify that a subArray is contained within an array.
|
||||
*
|
||||
* @param {Array} array
|
||||
* @param {Array} subArray
|
||||
*/
|
||||
|
||||
function arrayContains(array, subArray) {
|
||||
var found;
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
for (var i = 0; i < subArray.length; i++) {
|
||||
found = false;
|
||||
for (var j = 0; j < arr.length; j++) {
|
||||
if (expected[i] === arr[j]) {
|
||||
for (var j = 0; j < array.length; j++) {
|
||||
if (subArray[i] === array[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//Date_constants.js
|
||||
// Copyright 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.
|
||||
|
||||
var date_1899_end = -2208988800001;
|
|
@ -6,4 +6,6 @@ function checkSequence(arr, message) {
|
|||
" '" + arr.join(',') + "'");
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
|
@ -7,8 +7,7 @@ info: >
|
|||
a constructor: it initialises the newly created object
|
||||
es5id: 15.9.3.2_A1_T1
|
||||
description: Checking types of newly created objects and it values
|
||||
includes:
|
||||
- Date_constants.js
|
||||
includes: [dateConstants.js]
|
||||
---*/
|
||||
|
||||
if (typeof new Date(date_1899_end) !== "object") {
|
||||
|
|
|
@ -8,8 +8,7 @@ info: >
|
|||
initial value of Date.prototype
|
||||
es5id: 15.9.3.2_A2_T1
|
||||
description: Checking Date.prototype property of newly constructed objects
|
||||
includes:
|
||||
- Date_constants.js
|
||||
includes: [dateConstants.js]
|
||||
---*/
|
||||
|
||||
var x11 = new Date(date_1899_end);
|
||||
|
|
|
@ -7,8 +7,7 @@ info: >
|
|||
is set to "Date"
|
||||
es5id: 15.9.3.2_A3_T1.1
|
||||
description: Test based on delete prototype.toString
|
||||
includes:
|
||||
- Date_constants.js
|
||||
includes: [dateConstants.js]
|
||||
---*/
|
||||
|
||||
var x1 = new Date(date_1899_end);
|
||||
|
|
|
@ -7,8 +7,7 @@ info: >
|
|||
is set to "Date"
|
||||
es5id: 15.9.3.2_A3_T1.2
|
||||
description: Test based on overwriting prototype.toString
|
||||
includes:
|
||||
- Date_constants.js
|
||||
includes: [dateConstants.js]
|
||||
---*/
|
||||
|
||||
Date.prototype.toString = Object.prototype.toString;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
info: Promise.all([]) is resolved immediately
|
||||
es6id: 25.4.4.1_A2.2_T1
|
||||
author: Sam Mikes
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
description: Promise.all([]) returns immediately
|
||||
flags: [async]
|
||||
---*/
|
||||
|
|
|
@ -8,7 +8,7 @@ info: >
|
|||
es6id: S25.4.4.1_A7.2_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.all() accepts a one-element array
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.1_A8.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.all([p1, p2]) resolution functions are called in predictable sequence
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ info: >
|
|||
es6id: S25.4.4.1_A8.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.all() rejects when a promise in its array rejects
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ info: >
|
|||
es6id: S25.4.4.1_A8.2_T2
|
||||
author: Sam Mikes
|
||||
description: Promise.all() rejects when second promise in array rejects
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ info: >
|
|||
es6id: S25.4.2.1_A3.2_T2
|
||||
author: Sam Mikes
|
||||
description: Promise onResolved functions are called in predictable sequence
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ info: >
|
|||
es6id: S25.4.4_A2.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise onResolved functions are called in predictable sequence
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ info: >
|
|||
es6id: S25.4.4_A2.1_T2
|
||||
author: Sam Mikes
|
||||
description: Promise onResolved functions are called in predictable sequence
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ info: >
|
|||
es6id: S25.4.4_A2.1_T3
|
||||
author: Sam Mikes
|
||||
description: Promise onResolved functions are called in predictable sequence
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ info: >
|
|||
es6id: S25.4.5.3_A5.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.prototype.then enqueues handler if pending
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ info: >
|
|||
es6id: S25.4.5.3_A5.2_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.prototype.then immediately queues handler if fulfilled
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ info: >
|
|||
es6id: S25.4.5.3_A5.3_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.prototype.then immediately queues handler if rejected
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.3_A6.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.race([1]) settles immediately
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.3_A6.2_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.race([p1]) settles immediately
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.3_A7.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.race([p1, p2]) settles when first settles
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.3_A7.1_T2
|
||||
author: Sam Mikes
|
||||
description: Promise.race([p1, p2]) settles when first settles
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.3_A7.1_T3
|
||||
author: Sam Mikes
|
||||
description: Promise.race([p1, p2]) settles when first settles
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
es6id: S25.4.4.3_A7.2_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.race([p1, p2]) settles when first settles
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ info: >
|
|||
es6id: S25.4.4.5_A3.1_T1
|
||||
author: Sam Mikes
|
||||
description: Promise.resolve delegates to foreign thenable
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ info: >
|
|||
es6id: S25.4.4.5
|
||||
author: Sam Mikes
|
||||
description: Promise.resolve delegates to foreign thenable
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ info: >
|
|||
es6id: S25.4.4.5
|
||||
author: Sam Mikes
|
||||
description: Promise.resolve delegates to foreign thenable
|
||||
includes: [PromiseHelper.js]
|
||||
includes: [promiseHelper.js]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Assert that the contents of an array contains another array as a slice or sub-array
|
||||
includes: [arrayContains.js]
|
||||
---*/
|
||||
|
||||
const willMatch = [0, 1, 2];
|
||||
|
||||
assert(arrayContains([0, 1, 2, 3], willMatch));
|
||||
assert(arrayContains([null, 0, 1, 2, 3], willMatch));
|
||||
assert(arrayContains([undefined, 0, 1, 2, 3], willMatch));
|
||||
assert(arrayContains([false, 0, 1, 2, 3], willMatch));
|
||||
assert(arrayContains([NaN, 0, 1, 2, 3], willMatch));
|
||||
|
||||
const willNotMatch = [1, 0, 2];
|
||||
|
||||
assert(!arrayContains([1, /* intentional hole */, 2], willNotMatch), '[1, /* intentional hole */, 2], willNotMatch)');
|
||||
assert(!arrayContains([1, null, 2], willNotMatch), '[1, null, 2], willNotMatch)');
|
||||
assert(!arrayContains([1, undefined, 2], willNotMatch), '[1, undefined, 2], willNotMatch)');
|
||||
assert(!arrayContains([1, false, 2], willNotMatch), '[1, false, 2], willNotMatch)');
|
||||
assert(!arrayContains([1, NaN, 2], willNotMatch), '[1, NaN, 2], willNotMatch)');
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including dateConstants.js will expose:
|
||||
|
||||
var date_1899_end = -2208988800001;
|
||||
var date_1900_start = -2208988800000;
|
||||
var date_1969_end = -1;
|
||||
var date_1970_start = 0;
|
||||
var date_1999_end = 946684799999;
|
||||
var date_2000_start = 946684800000;
|
||||
var date_2099_end = 4102444799999;
|
||||
var date_2100_start = 4102444800000;
|
||||
|
||||
includes: [dateConstants.js]
|
||||
---*/
|
||||
assert.sameValue(date_1899_end, -2208988800001);
|
||||
assert.sameValue(date_1900_start, -2208988800000);
|
||||
assert.sameValue(date_1969_end, -1);
|
||||
assert.sameValue(date_1970_start, 0);
|
||||
assert.sameValue(date_1999_end, 946684799999);
|
||||
assert.sameValue(date_2000_start, 946684800000);
|
||||
assert.sameValue(date_2099_end, 4102444799999);
|
||||
assert.sameValue(date_2100_start, 4102444800000);
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Including decimalToHexString.js will expose two functions:
|
||||
|
||||
decimalToHexString
|
||||
decimalToPercentHexString
|
||||
|
||||
includes: [decimalToHexString.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(decimalToHexString(-1), "FFFFFFFF");
|
||||
assert.sameValue(decimalToHexString(0.5), "0000");
|
||||
assert.sameValue(decimalToHexString(1), "0001");
|
||||
assert.sameValue(decimalToHexString(100), "0064");
|
||||
assert.sameValue(decimalToHexString(65535), "FFFF");
|
||||
assert.sameValue(decimalToHexString(65536), "10000");
|
||||
|
||||
assert.sameValue(decimalToPercentHexString(-1), "%FF");
|
||||
assert.sameValue(decimalToPercentHexString(0.5), "%00");
|
||||
assert.sameValue(decimalToPercentHexString(1), "%01");
|
||||
assert.sameValue(decimalToPercentHexString(100), "%64");
|
||||
assert.sameValue(decimalToPercentHexString(65535), "%FF");
|
||||
assert.sameValue(decimalToPercentHexString(65536), "%00");
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including detachArrayBuffer.js will expose a function:
|
||||
|
||||
$DETACHBUFFER
|
||||
|
||||
$DETACHBUFFER relies on the presence of a definition for $262.detachArrayBuffer
|
||||
|
||||
includes: [detachArrayBuffer.js,sta.js]
|
||||
---*/
|
||||
|
||||
var $262 = {
|
||||
detachArrayBuffer() {
|
||||
throw new Test262Error('$262.detachArrayBuffer called.');
|
||||
}
|
||||
};
|
||||
|
||||
var ab = new ArrayBuffer(1);
|
||||
var threw = false;
|
||||
|
||||
try {
|
||||
$DETACHBUFFER(ab);
|
||||
} catch(err) {
|
||||
threw = true;
|
||||
if (err.constructor !== Test262Error) {
|
||||
$ERROR(
|
||||
'Expected a Test262Error, but a "' + err.constructor.name +
|
||||
'" was thrown.'
|
||||
);
|
||||
}
|
||||
if (err.message !== '$262.detachArrayBuffer called.') {
|
||||
$ERROR(`Expected error message: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (threw === false) {
|
||||
$ERROR('Expected a Test262Error, but no error was thrown.');
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including detachArrayBuffer.js will expose a function:
|
||||
|
||||
$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]
|
||||
---*/
|
||||
|
||||
var ab = new ArrayBuffer(1);
|
||||
var threw = false;
|
||||
|
||||
try {
|
||||
$DETACHBUFFER(ab);
|
||||
} catch(err) {
|
||||
threw = true;
|
||||
if (err.constructor !== ReferenceError) {
|
||||
$ERROR(
|
||||
'Expected a ReferenceError, but a "' + err.constructor.name +
|
||||
'" was thrown.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (threw === false) {
|
||||
$ERROR('Expected a ReferenceError, but no error was thrown.');
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including fnGlobalObject.js will expose a function:
|
||||
|
||||
fnGlobalObject
|
||||
|
||||
fnGlobalObject returns a reference to the global object.
|
||||
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
var gO = fnGlobalObject();
|
||||
|
||||
assert(typeof gO === "object");
|
||||
assert.sameValue(gO, this);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2017 Rick Waldron, 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including nans.js will expose:
|
||||
|
||||
var distinctNaNs = [
|
||||
0/0, Infinity/Infinity, -(0/0), Math.pow(-1, 0.5), -Math.pow(-1, 0.5)
|
||||
];
|
||||
|
||||
includes: [nans.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Number.isNaN(distinctNaNs[0]), true);
|
||||
assert.sameValue(Number.isNaN(distinctNaNs[1]), true);
|
||||
assert.sameValue(Number.isNaN(distinctNaNs[2]), true);
|
||||
assert.sameValue(Number.isNaN(distinctNaNs[3]), true);
|
||||
assert.sameValue(Number.isNaN(distinctNaNs[4]), true);
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including promiseHelper.js will expose a function:
|
||||
|
||||
checkSequence
|
||||
|
||||
To ensure execution order of some async chain, checkSequence accepts an array
|
||||
of numbers, each added during some operation, and verifies that they
|
||||
are in numeric order.
|
||||
|
||||
includes: [promiseHelper.js,sta.js]
|
||||
---*/
|
||||
|
||||
assert(checkSequence([1, 2, 3, 4, 5]));
|
||||
|
||||
var threw = false;
|
||||
|
||||
try {
|
||||
checkSequence([2, 1, 3, 4, 5]);
|
||||
} catch(err) {
|
||||
threw = true;
|
||||
if (err.constructor !== Test262Error) {
|
||||
$ERROR(
|
||||
'Expected a Test262Error, but a "' + err.constructor.name +
|
||||
'" was thrown.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (threw === false) {
|
||||
$ERROR('Expected a Test262Error, but no error was thrown.');
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Including sta.js will expose two functions:
|
||||
|
||||
Test262Error
|
||||
$ERROR
|
||||
|
||||
Assert that global $ERROR is overridable
|
||||
includes: [sta.js]
|
||||
---*/
|
||||
function BaloneyError() {}
|
||||
|
||||
// Override $ERROR
|
||||
$ERROR = function() {
|
||||
throw new BaloneyError();
|
||||
};
|
||||
|
||||
assert.throws(BaloneyError, function() {
|
||||
$ERROR();
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including sta.js will expose two functions:
|
||||
|
||||
Test262Error
|
||||
$ERROR
|
||||
|
||||
includes: [sta.js]
|
||||
---*/
|
||||
|
||||
assert(typeof Test262Error === "function");
|
||||
assert(typeof Test262Error.prototype.toString === "function");
|
||||
assert(typeof $ERROR === "function");
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including tcoHelper.js will expose:
|
||||
|
||||
var $MAX_ITERATIONS = 100000;
|
||||
|
||||
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.
|
||||
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
|
||||
assert.sameValue($MAX_ITERATIONS, 100000);
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including testTypedArray.js will expose:
|
||||
|
||||
testTypedArrayConversions()
|
||||
|
||||
includes: [testTypedArray.js]
|
||||
---*/
|
||||
var threw = false;
|
||||
|
||||
try {
|
||||
testTypedArrayConversions({}, () => {});
|
||||
} catch(err) {
|
||||
threw = true;
|
||||
if (err.constructor !== TypeError) {
|
||||
throw new Error(
|
||||
'Expected a TypeError, but a "' + err.constructor.name +
|
||||
'" was thrown.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (threw === false) {
|
||||
$ERROR('Expected a TypeError, but no error was thrown.');
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including testTypedArray.js will expose:
|
||||
|
||||
testTypedArrayConversions()
|
||||
|
||||
includes: [testTypedArray.js]
|
||||
---*/
|
||||
var callCount = 0;
|
||||
var bcv = {
|
||||
values: [
|
||||
127,
|
||||
],
|
||||
expected: {
|
||||
Int8: [
|
||||
127,
|
||||
],
|
||||
Uint8: [
|
||||
127,
|
||||
],
|
||||
Uint8Clamped: [
|
||||
127,
|
||||
],
|
||||
Int16: [
|
||||
127,
|
||||
],
|
||||
Uint16: [
|
||||
127,
|
||||
],
|
||||
Int32: [
|
||||
127,
|
||||
],
|
||||
Uint32: [
|
||||
127,
|
||||
],
|
||||
Float32: [
|
||||
127,
|
||||
],
|
||||
Float64: [
|
||||
127,
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
testTypedArrayConversions(bcv, function(TA, value, expected, initial) {
|
||||
var sample = new TA([initial]);
|
||||
sample.fill(value);
|
||||
assert.sameValue(initial, 0);
|
||||
assert.sameValue(sample[0], expected);
|
||||
callCount++;
|
||||
});
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including testTypedArray.js will expose:
|
||||
|
||||
var typedArrayConstructors = [ array of TypedArray constructors ]
|
||||
var TypedArray
|
||||
|
||||
testWithTypedArrayConstructors()
|
||||
testTypedArrayConversions()
|
||||
|
||||
includes: [testTypedArray.js,arrayContains.js]
|
||||
---*/
|
||||
var TAConstructors = [
|
||||
Float64Array,
|
||||
Float32Array,
|
||||
Int32Array,
|
||||
Int16Array,
|
||||
Int8Array,
|
||||
Uint32Array,
|
||||
Uint16Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray
|
||||
];
|
||||
var length = TAConstructors.length;
|
||||
|
||||
assert(
|
||||
arrayContains(typedArrayConstructors, TAConstructors),
|
||||
"All TypedArray constructors are accounted for"
|
||||
);
|
||||
assert(typeof TypedArray === "function");
|
||||
assert.sameValue(TypedArray, Object.getPrototypeOf(Uint8Array));
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
testWithTypedArrayConstructors(() => callCount++);
|
||||
assert.sameValue(callCount, length);
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (c) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Including timer.js will expose:
|
||||
|
||||
setTimeout()
|
||||
|
||||
includes: [timer.js,fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
var gO = fnGlobalObject();
|
||||
|
||||
assert(typeof setTimeout === "function");
|
||||
assert(typeof gO.setTimeout === "function");
|
||||
assert.sameValue(gO.setTimeout, setTimeout);
|
||||
|
||||
// TODO: assert semantics
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2017 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Including propertyHelper.js will expose:
|
||||
|
||||
verifyProperty()
|
||||
...
|
||||
|
||||
includes: [propertyHelper.js,sta.js]
|
||||
---*/
|
||||
|
||||
var threw = false;
|
||||
var object = Object.defineProperty({}, "prop", {
|
||||
value: 1
|
||||
});
|
||||
|
||||
try {
|
||||
verifyProperty(object, "prop", {
|
||||
value: 2
|
||||
});
|
||||
} catch(err) {
|
||||
threw = true;
|
||||
if (err.constructor !== Test262Error) {
|
||||
throw new Error(
|
||||
'Expected a Test262Error, but a "' + err.constructor.name +
|
||||
'" was thrown.'
|
||||
);
|
||||
}
|
||||
|
||||
if (err.message !== 'descriptor value should be 2 Expected SameValue(«1», «0») to be true') {
|
||||
$ERROR('The error thrown did not define the specified message.');
|
||||
}
|
||||
}
|
||||
|
||||
if (threw === false) {
|
||||
$ERROR('Expected a Test262Error, but no error was thrown.');
|
||||
}
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression is a candidate for tail-call optimization.
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Expression within statement is a candidate for tail-call optimizati
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Statement within statement is a candidate for tail-call optimizatio
|
|||
esid: static-semantics-hasproductionintailposition
|
||||
flags: [onlyStrict]
|
||||
features: [tail-call-optimization]
|
||||
includes: [tco-helper.js]
|
||||
includes: [tcoHelper.js]
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
|
|
Loading…
Reference in New Issue