abstract out test runner into a module, move traceur and esnext tests to babel-preset-es2015, clean up and make existing tests more consistent

This commit is contained in:
Sebastian McKenzie 2015-11-08 21:58:01 -08:00
parent f13ba90f17
commit 5f40b53dee
655 changed files with 315 additions and 1664 deletions

View File

@ -26,6 +26,7 @@ lint:
clean: test-clean
rm -rf coverage
rm -rf packages/*/npm-debug*
test-clean:
rm -rf packages/*/test/tmp

View File

@ -25,7 +25,6 @@
"matcha": "^0.6.0",
"mkdirp": "^0.5.1",
"mocha": "2.2.0",
"mocha-fixtures": "^2.0.0",
"output-file-sync": "^1.1.1",
"path-exists": "^1.0.0",
"readline-sync": "^1.2.19",

View File

@ -29,6 +29,9 @@
"source-map": "^0.5.0",
"v8flags": "^2.0.10"
},
"devDependencies": {
"babel-helper-fixtures": "^6.0.0"
},
"bin": {
"babel-doctor": "./bin/babel-doctor.js",
"babel": "./bin/babel.js",

View File

@ -1 +1,2 @@
var babelHelpers = {};
babelHelpers;

View File

@ -1,7 +1,7 @@
if (process.env.running_under_istanbul) return;
var readdir = require("fs-readdir-recursive");
var helper = require("mocha-fixtures");
var helper = require("babel-helper-fixtures");
var assert = require("assert");
var rimraf = require("rimraf");
var outputFileSync = require("output-file-sync");

View File

@ -51,6 +51,8 @@
"source-map-support": "^0.2.10"
},
"devDependencies": {
"babel-helper-fixtures": "^6.0.0",
"babel-helper-transform-fixture-test-runner": "^6.0.0",
"babel-polyfill": "^6.0.16"
}
}

View File

@ -68,6 +68,7 @@ function buildVar(namespace, builder) {
t.variableDeclarator(namespace, t.objectExpression([]))
]));
builder(body);
body.push(t.expressionStatement(namespace));
return t.program(body);
}
@ -81,7 +82,6 @@ function buildHelpers(body, namespace, whitelist) {
));
});
}
export default function (
whitelist?: Array<string>,
outputType: "global" | "umd" | "var" = "global",
@ -97,7 +97,7 @@ export default function (
let build = {
global: buildGlobal,
umd: buildUmd,
var: buildVar
var: buildVar,
}[outputType];
if (build) {

View File

@ -1,206 +0,0 @@
var babel = require("../lib/api/node");
var register = require("../register");
var path = require("path");
register({
ignore: [
path.resolve(__dirname + "/../.."),
"node_modules",
]
});
var buildExernalHelpers = require("../lib/tools/build-external-helpers");
var getFixtures = require("mocha-fixtures");
var sourceMap = require("source-map");
var codeFrame = require("babel-code-frame");
var Module = require("module");
var assert = require("assert");
var chai = require("chai");
var util = require("../lib/util");
var _ = require("lodash");
exports.fixtures = getFixtures(__dirname + "/fixtures", function () {
return require("../test-fixtures.json");
});
require("babel-polyfill");
eval(buildExernalHelpers());
global.assertNoOwnProperties = function (obj) {
assert.equal(Object.getOwnPropertyNames(obj).length, 0);
};
global.assertHasOwnProperty = function () {
};
global.assertLacksOwnProperty = function () {
};
global.assertArrayEquals = assert.deepEqual;
global.assert = chai.assert;
global.chai = chai;
// Different Traceur generator message
chai.assert._throw = chai.assert.throw;
chai.assert.throw = function (fn, msg) {
if (msg === '"throw" on executing generator' ||
msg === '"next" on executing generator') {
msg = "Generator is already running";
} else if (msg === "Sent value to newborn generator") {
msg = /^attempt to send (.*?) to newborn generator$/;
} else if (msg === "super prototype must be an Object or null") {
msg = "Object prototype may only be an Object or null";
}
return chai.assert._throw(fn, msg);
};
function wrapPackagesArray(type, names) {
return (names || []).map(function (val) {
if (typeof val === "string") val = [val];
val[0] = __dirname + "/../../babel-" + type + "-" + val[0];
return val;
});
}
function run(task, done) {
var actual = task.actual;
var expect = task.expect;
var exec = task.exec;
var opts = task.options;
function getOpts(self) {
var newOpts = _.merge({
suppressDeprecationMessages: true,
filename: self.loc,
sourceMap: !!(task.sourceMappings || task.sourceMap)
}, opts);
newOpts.plugins = wrapPackagesArray("plugin", newOpts.plugins);
newOpts.presets = wrapPackagesArray("preset", newOpts.presets).map(function (val) {
return val[0];
});
return newOpts;
}
var execCode = exec.code;
var result;
if (execCode) {
var execOpts = getOpts(exec);
result = babel.transform(execCode, execOpts);
execCode = result.code;
try {
runExec(exec.loc, execCode, done);
} catch (err) {
err.message = exec.loc + ": " + err.message;
err.message += codeFrame(execCode);
throw err;
}
}
var actualCode = actual.code;
var expectCode = expect.code;
if (!execCode || actualCode) {
result = babel.transform(actualCode, getOpts(actual));
actualCode = result.code.trim();
try {
chai.expect(actualCode).to.be.equal(expectCode, actual.loc + " !== " + expect.loc);
} catch (err) {
//require("fs").writeFileSync(expect.loc, actualCode);
throw err;
}
}
if (task.sourceMap) {
chai.expect(result.map).to.deep.equal(task.sourceMap);
}
if (task.sourceMappings) {
var consumer = new sourceMap.SourceMapConsumer(result.map);
_.each(task.sourceMappings, function (mapping, i) {
var actual = mapping.original;
var expect = consumer.originalPositionFor(mapping.generated);
chai.expect({ line: expect.line, column: expect.column }).to.deep.equal(actual);
});
}
}
function multiline(arr) {
return arr.join("\n");
}
function runExec(filename, execCode, done) {
function fakeRequire(loc) {
if (loc === "../../../src/runtime/polyfills/Number.js") {
return Number;
} else if (loc === "../../../src/runtime/polyfills/Math.js") {
return Math;
} else {
return require(path.resolve(filename, "..", loc));
}
}
var fn = new Function("multiline", "require", "assert", "exports", "done", "transform", execCode);
return fn.call(global, multiline, fakeRequire, chai.assert, {}, done, babel.transform);
}
exports.run = function (name, suiteOpts, taskOpts, dynamicOpts) {
suiteOpts = suiteOpts || {};
taskOpts = taskOpts || {};
_.each(exports.fixtures[name], function (testSuite) {
if (_.contains(suiteOpts.ignoreSuites, testSuite.title)) return;
suite(name + "/" + testSuite.title, function () {
setup(function () {
require("../register")(taskOpts);
});
_.each(testSuite.tests, function (task) {
if (_.contains(suiteOpts.ignoreTasks, task.title) || _.contains(suiteOpts.ignoreTasks, testSuite.title + "/" + task.title)) return;
var runTest = function (done) {
var runTask = function () {
run(task, done);
};
_.extend(task.options, taskOpts);
if (dynamicOpts) dynamicOpts(task.options, task);
var throwMsg = task.options.throws;
if (throwMsg) {
// internal api doesn't have this option but it's best not to pollute
// the options object with useless options
delete task.options.throws;
assert.throws(runTask, function (err) {
return throwMsg === true || err.message.indexOf(throwMsg) >= 0;
});
} else {
runTask();
}
};
var callback;
if (task.options.asyncExec) {
callback = runTest;
} else {
callback = function () {
return runTest();
};
}
test(task.title, !task.disabled && callback);
});
});
});
};

View File

@ -1 +0,0 @@
require("./_transformation-helper").run("esnext");

View File

@ -1,5 +0,0 @@
// Error: :4:16: Unexpected token =
function f() {
({a = (0, {a = 0})} = {})
}

View File

@ -1,3 +0,0 @@
// Error: :3:5: Unexpected token =
({a = 0});

View File

@ -1,3 +0,0 @@
// Error: :3:18: Unexpected token =
var f = ({x = {y = 1}) => 2;

View File

@ -1,4 +0,0 @@
// Options: --arrow-functions=false
// Error: :4:21: Unexpected token >
var identity = (x) => x;

View File

@ -1,3 +0,0 @@
// Options: --arrow-functions --free-variable-checker
// Error: :3:35: missingIdentifier is not defined
var identity = (identityParam) => missingIdentifier;

View File

@ -1,3 +0,0 @@
// Error: :3:15: Unexpected token +
var f = (a, b + 5) => a + b;

View File

@ -1,4 +0,0 @@
// Error: :4:1: Unexpected token =>
x
=>1

View File

@ -1,3 +0,0 @@
// Error: :3:26: Semi-colon expected
var identity = (x) => {x}.bind({});

View File

@ -1,4 +0,0 @@
// Error: :4:11: Semi-colon expected
// Error: :4:11: Unexpected token =>
(x) + (y) => y;

View File

@ -1,4 +0,0 @@
// Error: :4:9: Semi-colon expected
// Error: :4:9: Unexpected token =>
(x) + y => y;

View File

@ -1,6 +0,0 @@
// Error: :5:17: Unexpected token ,
// Error: :5:12: Unexpected token ...
{
let f = (...xs, x) => xs;
}

View File

@ -1,3 +0,0 @@
// Error: :3:13: Unexpected token ...
var f = (x, ...xs);

View File

@ -1,39 +0,0 @@
// Skip. Not implemented.
// TODO: needs # prefix implemented for freezing
// Use # to freeze and join to nearest relevant closure
function return_pure() {
return #(a) -> a * a;
}
let p = return_pure(),
q = return_pure();
assert(p === q);
function check_frozen(o) {
try {
o.x = "expando";
assert(! "reached");
} catch (e) {
// e is something like "TypeError: o is not extensible"
assert(e.name == "TypeError");
}
}
check_frozen(p);
function partial_mul(a) {
return #(b) -> a * b;
}
let x = partial_mul(3),
y = partial_mul(4),
z = partial_mul(3);
assert(x !== y);
assert(x !== z);
assert(y !== z);
check_frozen(x);
check_frozen(y);
check_frozen(z);

View File

@ -1,19 +0,0 @@
// Skip. Not implemented.
// TODO: needs the intializer shorthand implemented for arrow functions
// Object intializer shorthand: "method" = function-valued property with dynamic ''this''
const obj = {
method() -> {
return => this;
}
};
assert(obj.method() === obj);
assert(obj.method.call(u) === u);
// Name binding forms hoist to body (var) or block (let, const) top
var warmer(a) -> { return a; };
let warm(b) -> { return b; };
const colder(c) -> { return c; };
const #coldest(d) -> {...};

View File

@ -1,14 +0,0 @@
// Skip. Not implemented.
// TODO: needs soft bind and ??= implemented
// A special form based on the default operator proposal
const self_default_bound = (this ??= self, a, b) -> {
this.c = a * b;
}
self_default_bound(6, 7);
assert(self.c === 42);
self_default_bound.call(other, 8, 9);
assert(other.c === 72);
assert(self.c === 42);

View File

@ -1,7 +0,0 @@
// Options: --async-functions
// Error: :7:5: Semi-colon expected
// Error: :7:5: Unexpected token =>
var async = () => 1;
var x = async
(y) => y;

View File

@ -1,6 +0,0 @@
// Options: --async-functions
// Error: :6:1: Unexpected token =>
var async = () => 1;
var x = async (y)
=> y;

View File

@ -1,15 +0,0 @@
// Disabled by default.
// Error: :13:21: Semi-colon expected
function asyncComplete() {
return new Promise((resolve) => {
resolve('complete');
});
}
// ----------------------------------------------------------------------------
(async function() {
var value = async asyncComplete();
assert.equal('complete', value);
})();

View File

@ -1,4 +0,0 @@
// Options: --classes=false
// Error: :4:1: Unexpected reserved word
class C {}

View File

@ -1,5 +0,0 @@
// Error: :5:19: Unexpected token =
// extends LeftHandSideExpression
// see https://github.com/google/traceur-compiler/issues/1556
class A extends B = C {}

View File

@ -1,22 +0,0 @@
// Error: :8:14: super is only allowed in methods
// Error: :14:16: super is only allowed in methods
// Error: :19:19: super is only allowed in methods
class C {
superM() {
return (function() {
return super.m();
})();
}
superX2() {
return (function() {
return (function() {
return super.x;
})();
})();
}
constructor() {
(function() { super(); })();
}
}

View File

@ -1,7 +0,0 @@
// Error: :5:14: Unexpected token (
class C {
m() {
new super();
}
}

View File

@ -1,7 +0,0 @@
// Error: :6:3: Unexpected token }
class C {
m() {
new super
}
}

View File

@ -1,9 +0,0 @@
// Error: :6:3: Derived constructor must call super()
class B {}
class C extends B {
constructor() {
// no super call
}
}

View File

@ -1,10 +0,0 @@
// Error: :7:17: Unexpected token ;
class A {}
class ImproperSuper extends A {
method() {
return super;
}
}

View File

@ -1,10 +0,0 @@
// Error: :7:18: Unexpected token `
class A {}
class ImproperSuper extends A {
method() {
return super ``;
}
}

View File

@ -1,7 +0,0 @@
// Error: :5:5: super call is only allowed in derived constructor
class C {
constructor() {
super();
}
}

View File

@ -1,15 +0,0 @@
// Error: :12:5: 'this' is not allowed before super()
class Animal {}
class Roo extends Animal {
constructor() {
class Koala extends Animal {
constructor() {
super();
}
}
this.a = new Koala;
super();
}
}

View File

@ -1,10 +0,0 @@
// Error: :6:3: super is only allowed in methods
// Error: :9:15: super is only allowed in methods
// Error: :10:17: super is only allowed in methods
function f() {
super.x;
}
var g = () => super.y;
var h = () => { super.z; }

View File

@ -1,39 +0,0 @@
// Skip. Not implemented.
// Only in browser.
class CustomButton extends HTMLButtonElement {
constructor() {
this.value = 'Custom Button';
}
}
class CustomSelect extends HTMLSelectElement {}
class CustomInput extends HTMLInputElement {}
class CustomDiv extends HTMLDivElement {}
class CustomUIEvent extends UIEvent {}
// class CustomSpan extends HTMLSpanElement {}
class CustomTableRow extends HTMLTableRowElement {}
class CustomHeading extends HTMLHeadingElement {}
class CustomElement extends HTMLElement {}
class CustomUList extends HTMLUListElement {}
class CustomLI extends HTMLLIElement {}
class CustomMenu extends HTMLMenuElement {}
class CustomTextArea extends HTMLTextAreaElement {}
// ----------------------------------------------------------------------------
var button = new CustomButton();
document.body.appendChild(button);
document.body.appendChild(new CustomSelect());
document.body.appendChild(new CustomInput());
document.body.appendChild(new CustomDiv());
// document.body.appendChild(new CustomSpan());
document.body.appendChild(new CustomTableRow());
document.body.appendChild(new CustomHeading());
document.body.appendChild(new CustomElement());
document.body.appendChild(new CustomUList());
document.body.appendChild(new CustomLI());
document.body.appendChild(new CustomMenu());
document.body.appendChild(new CustomTextArea());
// TODO(rnystrom): Test these.

View File

@ -1,16 +0,0 @@
// Skip. Not implemented.
// Only in browser.
class CustomBlockquote extends HTMLBlockquoteElement {
constructor() {
this.custom = 42;
}
}
var customBlockquote = new CustomBlockquote;
assert.equal(42, customBlockquote.custom);
assert.equal('BLOCKQUOTE', customBlockquote.tagName);
assert.isTrue(customBlockquote instanceof CustomBlockquote);
assert.isTrue(customBlockquote instanceof HTMLBlockquoteElement);
assert.isTrue(customBlockquote instanceof HTMLQuoteElement);
assert.isTrue(customBlockquote instanceof HTMLElement);

View File

@ -1,6 +0,0 @@
// Options: --computed-property-names=false
// Error: :5:3: Unexpected token [
var object = {
[1]: 2
};

View File

@ -1,6 +0,0 @@
// Error: :5:15: Unexpected token =
var object = {
// Default parameters are not allowed on setters.
set x(value = 42) {}
}

View File

@ -1,4 +0,0 @@
// Options: --destructuring=false
// Error: 4:5: Unexpected token [
var [x, y] = [0, 1];

View File

@ -1,4 +0,0 @@
// Error: :3:19: Unexpected token in
for (var {k} = {} in {}) {
}

View File

@ -1,4 +0,0 @@
// Error: :3:19: Unexpected token of
for (var {k} = {} of []) {
}

View File

@ -1,3 +0,0 @@
// Error: :3:16: Unexpected token ,
var f = ([...xs, ys]) => xs;

View File

@ -1,3 +0,0 @@
// Error: :3:5: Unexpected token =
({x = 42});

View File

@ -1,4 +0,0 @@
// Options: --generator-comprehension=false
// Error: :4:13: Unexpected reserved word for
var iter = (for (x of [0, 1, 2, 3, 4]) x);

View File

@ -1,5 +0,0 @@
// Options: --generator-comprehension --free-variable-checker
// Error: :5:1: notDefined is not defined
var iter = (for (notDefined of [0]) notDefined);
notDefined;

View File

@ -1,40 +0,0 @@
// Options: --generator-comprehension
function accumulate(iterator) {
var result = '';
for (var value of iterator) {
result = result + String(value);
}
return result;
}
function* range() {
for (var i = 0; i < 5; i++) {
yield i;
}
}
var iter = (for (x of [0, 1, 2, 3, 4]) x);
assert.equal('01234', accumulate(iter));
var iter2 = (for (x of [0, 1, 2, 3, 4]) for (y of [0, 1, 2, 3, 4]) x + '' + y );
assert.equal('00010203041011121314202122232430313233344041424344',
accumulate(iter2));
var iter3 = (
for (x of [0, 1, 2, 3, 4])
for (y of range())
if (x === y)
x + '' + y);
assert.equal('0011223344', accumulate(iter3));
// Ensure this works as expression statement
(for (testVar of []) testVar);
var iter4 = (
for (x of range())
if (x % 2 === 0)
for (y of range())
if (y % 2 === 1)
x + '' + y);
assert.equal('010321234143', accumulate(iter4));

View File

@ -1,23 +0,0 @@
// Options: --generator-comprehension
// Skip. The sugaring uses var instead of let which leads to wrong closure.
var iter = (for (x of [0, 1]) for (y of [2, 3]) () => [x, y] );
assert.isTrue(iter.moveNext());
var f1 = iter.current;
assert.isTrue(iter.moveNext());
var f2 = iter.current;
assert.isTrue(iter.moveNext());
var f3 = iter.current;
assert.isTrue(iter.moveNext());
var f4 = iter.current;
assert.isFalse(iter.moveNext());
assertArrayEquals([0, 2], f1());
assertArrayEquals([0, 3], f2());
assertArrayEquals([1, 2], f3());
assertArrayEquals([1, 3], f4());

View File

@ -1,8 +0,0 @@
import {acosh} from '../../../src/runtime/polyfills/Math.js';
function testAcosh(acosh) {
assert.equal(0, acosh(1));
}
testAcosh(acosh);
testAcosh(Math.acosh);

View File

@ -1,8 +0,0 @@
import {asinh} from '../../../src/runtime/polyfills/Math.js';
function testAsinh(asinh) {
assert.equal(0, asinh(0));
}
testAsinh(asinh);
testAsinh(Math.asinh);

View File

@ -1,8 +0,0 @@
import {atanh} from '../../../src/runtime/polyfills/Math.js';
function testAtanh(atanh) {
assert.equal(0, atanh(0));
}
testAtanh(atanh);
testAtanh(Math.atanh);

View File

@ -1,8 +0,0 @@
import {cbrt} from '../../../src/runtime/polyfills/Math.js';
function testCbrt(cbrt) {
assert.equal(0, cbrt(0));
}
testCbrt(cbrt);
testCbrt(Math.cbrt);

View File

@ -1,9 +0,0 @@
import {clz32} from '../../../src/runtime/polyfills/Math.js';
function testClz32(clz32) {
[NaN, Infinity, -Infinity, 0, -0, 'abc', 'Infinity', '-Infinity', {}].forEach(
(x) => assert.equal(32, clz32(x)));
}
testClz32(clz32);
testClz32(Math.clz32);

View File

@ -1,11 +0,0 @@
import {cosh} from '../../../src/runtime/polyfills/Math.js';
function testCosh(cosh) {
assert.equal(Infinity, cosh(-Infinity));
assert.equal(Infinity, cosh(Infinity));
assert.equal(1, cosh(0));
assert.equal(1, cosh(-0));
}
testCosh(cosh);
testCosh(Math.cosh);

View File

@ -1,9 +0,0 @@
import {expm1} from '../../../src/runtime/polyfills/Math.js';
function testExpm1(expm1) {
assert.equal(Infinity, expm1(Infinity));
assert.equal(-1, expm1(-Infinity));
}
testExpm1(expm1);
testExpm1(Math.expm1);

View File

@ -1,22 +0,0 @@
import {fround} from '../../../src/runtime/polyfills/Math.js';
import {fround as jsFround} from '../../../src/runtime/polyfills/fround.js';
function testFround(x, expected) {
assert.strictEqual(expected, Math.fround(x));
assert.strictEqual(expected, fround(x));
assert.strictEqual(expected, jsFround(x));
}
testFround(0, 0);
testFround(-0, -0);
testFround(Infinity, Infinity);
testFround(-Infinity, -Infinity);
assert.isTrue(isNaN(Math.fround(NaN)));
assert.isTrue(isNaN(fround(NaN)));
assert.isTrue(isNaN(jsFround(NaN)));
testFround(1, 1);
testFround(1.5, 1.5);
testFround(1.6, 1.600000023841858);
testFround(1.337, 1.3370000123977661);

View File

@ -1,9 +0,0 @@
import {hypot} from '../../../src/runtime/polyfills/Math.js';
function testHypot(hypot) {
assert.equal(1, hypot(1));
assert.equal(Math.PI, hypot(Math.PI));
}
testHypot(hypot);
testHypot(Math.hypot);

View File

@ -1,8 +0,0 @@
import {imul} from '../../../src/runtime/polyfills/Math.js';
function testImul(imul) {
assert.equal(8, imul(2, 4));
}
testImul(imul);
testImul(Math.imul);

View File

@ -1,9 +0,0 @@
import {log10} from '../../../src/runtime/polyfills/Math.js';
function testLog10(log10) {
assert.equal(1, log10(10));
assert.equal(2, log10(100));
}
testLog10(log10);
testLog10(Math.log10);

View File

@ -1,8 +0,0 @@
import {log1p} from '../../../src/runtime/polyfills/Math.js';
function testLog1p(log1p) {
assert.equal(0, log1p(0));
}
// testLog1p(log1p);
testLog1p(Math.log1p);

View File

@ -1,9 +0,0 @@
import {log2} from '../../../src/runtime/polyfills/Math.js';
function testLog2(log2) {
assert.equal(1, log2(2));
assert.equal(2, log2(4));
}
testLog2(log2);
testLog2(Math.log2);

View File

@ -1,11 +0,0 @@
import {sign} from '../../../src/runtime/polyfills/Math.js';
function testSign(sign) {
assert.equal(1, sign(1));
assert.equal(-1, sign(-1));
assert.equal(0, sign(0));
assert.equal(-0, sign(-0));
}
testSign(sign);
testSign(Math.sign);

View File

@ -1,11 +0,0 @@
import {sinh} from '../../../src/runtime/polyfills/Math.js';
function testSinh(sinh) {
assert.equal(0, sinh(0));
assert.equal(-0, sinh(-0));
assert.equal(Infinity, sinh(Infinity));
assert.equal(-Infinity, sinh(-Infinity));
}
testSinh(sinh);
testSinh(Math.sinh);

View File

@ -1,11 +0,0 @@
import {tanh} from '../../../src/runtime/polyfills/Math.js';
function testTanh(tanh) {
assert.equal(0, tanh(0));
assert.equal(-0, tanh(-0));
assert.equal(1, tanh(Infinity));
assert.equal(-1, tanh(-Infinity));
}
testTanh(tanh);
testTanh(Math.tanh);

View File

@ -1,14 +0,0 @@
import {trunc} from '../../../src/runtime/polyfills/Math.js';
function testTrunc(trunc) {
assert.equal(0, trunc(0));
assert.equal(-0, trunc(-0));
assert.equal(Infinity, trunc(Infinity));
assert.equal(-Infinity, trunc(-Infinity));
assert.equal(42, trunc(42));
assert.equal(2, trunc(2.5));
assert.equal(-2, trunc(-2.5));
}
testTrunc(trunc);
testTrunc(Math.trunc);

View File

@ -1,10 +0,0 @@
// Error: test/feature/Modules/Error_DuplicateImport.module.js:6:9: 'a' was previously imported at test/feature/Modules/Error_DuplicateImport.module.js:5:9
// Error: test/feature/Modules/Error_DuplicateImport.module.js:9:8: 'd' was previously imported at test/feature/Modules/Error_DuplicateImport.module.js:8:8
// Error: test/feature/Modules/Error_DuplicateImport.module.js:10:9: 'd' was previously imported at test/feature/Modules/Error_DuplicateImport.module.js:8:8
import {a} from './resources/a.js';
import {c as a} from './resources/c.js';
import d from './resources/default-class.js';
import d from './resources/default-name.js';
import {a as d} from './resources/a2.js';

View File

@ -1,3 +0,0 @@
// Error: :3:9: Unexpected token if
export {if};

View File

@ -1,3 +0,0 @@
// Error: :3:9: Unexpected token if
export {if as x};

View File

@ -1,3 +0,0 @@
// Error: test/feature/Modules/resources/export-conflict.js:2:8: Duplicate export. 'a' was previously exported at test/feature/Modules/resources/export-conflict.js:1:12
import {a} from './resources/export-conflict.js';

View File

@ -1,6 +0,0 @@
// Error: test/feature/Modules/Error_ExportStarDuplicateExport.module.js:4:8: Duplicate export. 'a' was previously exported at test/feature/Modules/Error_ExportStarDuplicateExport.module.js:3:8
export * from './resources/a.js';
export * from './resources/a2.js';
assert.equal(1, 2);

View File

@ -1,3 +0,0 @@
// Error: test/feature/Modules/Error_ImportDefault.module.js:3:8: 'default' is not exported by 'test/feature/Modules/resources/a.js'
import error from './resources/a.js';

View File

@ -1,4 +0,0 @@
// Error: :3:10: Unexpected token from
import * from './resources/m.js';
assert.equal(3, a + b);

View File

@ -1,3 +0,0 @@
// Error: :3:9: 'c' is not exported by 'test/feature/Modules/resources/a.js'
export {c} from './resources/a.js';

View File

@ -1,3 +0,0 @@
// Error: :3:9: 'c' is not exported by 'test/feature/Modules/resources/a.js'
export {c as d} from './resources/a.js';

View File

@ -1,3 +0,0 @@
// Error: test/feature/Modules/Error_InvalidExport3.module.js:3:9: 'c' is not exported by 'test/feature/Modules/resources/b.js'
export {c as d} from './resources/b.js';

View File

@ -1,7 +0,0 @@
// Error: 'test/feature/Modules/resources/no_such_file.js'
// Error: Specified as ./resources/no_such_file.js.
// Error: Imported by test/feature/Modules/Error_InvalidModuleDeclaration.module.js.
// Error: Normalizes to test/feature/Modules/resources/no_such_file.js
// Error: locate resolved against base
import * as b from './resources/no_such_file.js';

View File

@ -1,3 +0,0 @@
// Error: 3:38: Unexpected token .
import * as b from './resources/a.js'.c;

View File

@ -1,7 +0,0 @@
// Error: :5:12: 'y' is not exported by 'test/feature/Modules/resources/x.js'
// Error: :5:15: 'z' is not exported by 'test/feature/Modules/resources/x.js'
// Error: :6:9: 'w' is not exported by 'test/feature/Modules/resources/x.js'
import {x, y, z} from './resources/x.js';
import {w} from './resources/x.js';

View File

@ -1,10 +0,0 @@
import {EPSILON} from '../../../src/runtime/polyfills/Number.js';
function testEpsilon(epsilon) {
assert.equal(epsilon, Math.pow(2, -52));
assert.equal(1 + epsilon - 1, epsilon);
assert.equal(1 + epsilon / 2 - 1, 0);
}
testEpsilon(EPSILON);
testEpsilon(Number.EPSILON);

View File

@ -1,4 +0,0 @@
import {MAX_SAFE_INTEGER} from '../../../src/runtime/polyfills/Number.js';
assert.equal(MAX_SAFE_INTEGER, Math.pow(2, 53) - 1);
assert.equal(Number.MAX_SAFE_INTEGER, Math.pow(2, 53) - 1);

View File

@ -1,4 +0,0 @@
import {MIN_SAFE_INTEGER} from '../../../src/runtime/polyfills/Number.js';
assert.equal(MIN_SAFE_INTEGER, -Math.pow(2, 53) + 1);
assert.equal(Number.MIN_SAFE_INTEGER, -Math.pow(2, 53) + 1);

View File

@ -1,30 +0,0 @@
import {isFinite} from '../../../src/runtime/polyfills/Number.js';
function testIsFinite(isFinite) {
assert.isTrue(isFinite(-0));
assert.isTrue(isFinite(0));
assert.isTrue(isFinite(Number.EPSILON));
assert.isTrue(isFinite(Number.MAX_SAFE_INTEGER + 23));
assert.isTrue(isFinite(Number.MAX_VALUE));
assert.isTrue(isFinite(Number.MIN_SAFE_INTEGER - 13));
assert.isTrue(isFinite(Number.MIN_VALUE));
assert.isFalse(isFinite('-0'));
assert.isFalse(isFinite('0'));
assert.isFalse(isFinite('x'));
assert.isFalse(isFinite(-Infinity));
assert.isFalse(isFinite(-NaN));
assert.isFalse(isFinite(Infinity));
assert.isFalse(isFinite(NaN));
assert.isFalse(isFinite(Number.NEGATIVE_INFINITY));
assert.isFalse(isFinite(Number.POSITIVE_INFINITY));
assert.isFalse(isFinite(false));
assert.isFalse(isFinite(new Number(1)));
assert.isFalse(isFinite(null));
assert.isFalse(isFinite(true));
assert.isFalse(isFinite(undefined));
assert.isFalse(isFinite({valueOf() { return 1; }}));
}
testIsFinite(isFinite);
testIsFinite(Number.isFinite);

View File

@ -1,30 +0,0 @@
import {isInteger} from '../../../src/runtime/polyfills/Number.js';
function testIsInteger(isInteger) {
assert.isTrue(isInteger(-0));
assert.isTrue(isInteger(0));
assert.isTrue(isInteger(Number.MAX_SAFE_INTEGER + 23));
assert.isTrue(isInteger(Number.MAX_VALUE));
assert.isTrue(isInteger(Number.MIN_SAFE_INTEGER - 13));
assert.isFalse(isInteger('-0'));
assert.isFalse(isInteger('0'));
assert.isFalse(isInteger('x'));
assert.isFalse(isInteger(-Infinity));
assert.isFalse(isInteger(-NaN));
assert.isFalse(isInteger(Infinity));
assert.isFalse(isInteger(NaN));
assert.isFalse(isInteger(Number.EPSILON));
assert.isFalse(isInteger(Number.MIN_VALUE));
assert.isFalse(isInteger(Number.NEGATIVE_INFINITY));
assert.isFalse(isInteger(Number.POSITIVE_INFINITY));
assert.isFalse(isInteger(false));
assert.isFalse(isInteger(new Number(1)));
assert.isFalse(isInteger(null));
assert.isFalse(isInteger(true));
assert.isFalse(isInteger(undefined));
assert.isFalse(isInteger({valueOf() { return 1; }}));
}
testIsInteger(isInteger);
testIsInteger(Number.isInteger);

View File

@ -1,30 +0,0 @@
import {isNaN} from '../../../src/runtime/polyfills/Number.js';
function testIsNaN(isNaN) {
assert.isTrue(isNaN(NaN));
assert.isTrue(isNaN(-NaN));
assert.isFalse(isNaN('-0'));
assert.isFalse(isNaN('0'));
assert.isFalse(isNaN('NaN'));
assert.isFalse(isNaN('x'));
assert.isFalse(isNaN(-0));
assert.isFalse(isNaN(0));
assert.isFalse(isNaN(Infinity));
assert.isFalse(isNaN(Number.EPSILON));
assert.isFalse(isNaN(Number.MAX_SAFE_INTEGER + 23));
assert.isFalse(isNaN(Number.MAX_VALUE));
assert.isFalse(isNaN(Number.MIN_SAFE_INTEGER - 13));
assert.isFalse(isNaN(Number.MIN_VALUE));
assert.isFalse(isNaN(Number.NEGATIVE_INFINITY));
assert.isFalse(isNaN(Number.POSITIVE_INFINITY));
assert.isFalse(isNaN(false));
assert.isFalse(isNaN(new Number(NaN)));
assert.isFalse(isNaN(null));
assert.isFalse(isNaN(true));
assert.isFalse(isNaN(undefined));
assert.isFalse(isNaN({valueOf() { return NaN; }}));
}
testIsNaN(isNaN);
testIsNaN(Number.isNaN);

View File

@ -1,33 +0,0 @@
import {isSafeInteger} from '../../../src/runtime/polyfills/Number.js';
function testIsSafeInteger(isSafeInteger) {
assert.isTrue(isSafeInteger(-0));
assert.isTrue(isSafeInteger(0));
assert.isTrue(isSafeInteger(Number.MAX_SAFE_INTEGER - 23));
assert.isTrue(isSafeInteger(Number.MAX_SAFE_INTEGER));
assert.isTrue(isSafeInteger(Number.MIN_SAFE_INTEGER + 13));
assert.isFalse(isSafeInteger('-0'));
assert.isFalse(isSafeInteger('0'));
assert.isFalse(isSafeInteger('x'));
assert.isFalse(isSafeInteger(-Infinity));
assert.isFalse(isSafeInteger(-NaN));
assert.isFalse(isSafeInteger(Infinity));
assert.isFalse(isSafeInteger(NaN));
assert.isFalse(isSafeInteger(Number.EPSILON));
assert.isFalse(isSafeInteger(Number.MAX_SAFE_INTEGER + 23));
assert.isFalse(isSafeInteger(Number.MAX_VALUE));
assert.isFalse(isSafeInteger(Number.MIN_SAFE_INTEGER - 13));
assert.isFalse(isSafeInteger(Number.MIN_VALUE));
assert.isFalse(isSafeInteger(Number.NEGATIVE_INFINITY));
assert.isFalse(isSafeInteger(Number.POSITIVE_INFINITY));
assert.isFalse(isSafeInteger(false));
assert.isFalse(isSafeInteger(new Number(1)));
assert.isFalse(isSafeInteger(null));
assert.isFalse(isSafeInteger(true));
assert.isFalse(isSafeInteger(undefined));
assert.isFalse(isSafeInteger({valueOf() { return 1; }}));
}
testIsSafeInteger(isSafeInteger);
testIsSafeInteger(Number.isSafeInteger);

View File

@ -1,4 +0,0 @@
// Options: --numeric-literals=false
// Error: :4:2: Semi-colon expected
0b11;

View File

@ -1,4 +0,0 @@
// Options: --numeric-literals
// Error: :4:1: Binary Integer Literal must contain at least one digit
0b;

View File

@ -1,4 +0,0 @@
// Options: --numeric-literals
// Error: :4:1: Octal Integer Literal must contain at least one digit
0o;

View File

@ -1,5 +0,0 @@
// Options: --property-name-shorthand=false
// Error: :5:16: Unexpected token x
var x = 42;
var object = {x};

View File

@ -1,3 +0,0 @@
// Error: :3:18: Unexpected token var
var object = {var};

View File

@ -1,3 +0,0 @@
// Error: missingVarObjectInitializerShorthand is not defined
var object = {missingVarObjectInitializerShorthand};

View File

@ -1,12 +0,0 @@
// Error: :6:11: implements is a reserved identifier
// Error: :11:11: yield is a reserved identifier
function f() {
'use strict';
return {implements};
}
function g() {
'use strict';
return {yield};
}

View File

@ -1,17 +0,0 @@
// Skip.
// Async.
// V8 does not yet support iterable argument to Promise.all.
// https://code.google.com/p/v8/issues/detail?id=3705
function* gen() {
yield 1;
yield 2;
}
var p2 = Promise.all(gen());
p2.then((v) => {
assert.deepEqual(v, [1,2]);
done();
});

View File

@ -1,8 +0,0 @@
// Options: --property-methods=false
// Error: :5:9: Unexpected token (
var object = {
method() {
return 42;
}
};

View File

@ -1,8 +0,0 @@
assert.throws(() => {
var object = {
"notNamedField"() {
return notNamedField;
}
};
object.notNamedField();
}, ReferenceError);

View File

@ -1,6 +0,0 @@
// Error: :3:46: Unexpected token ,
function invalidParam(noDefault, ...restParam, noRestAgain) {
// Should fail to parse since non rest param is not allowed after
// param.
}

View File

@ -1,7 +0,0 @@
// Error: :4:9: Unexpected token ...
var object = {
set x(...rest) {
// rest is not allowed for set accessor
}
};

Some files were not shown because too many files have changed in this diff Show More