From 8ee8d8c63c0e36ea72089efa8bb25dafa7fbc691 Mon Sep 17 00:00:00 2001 From: Yui Date: Mon, 25 Apr 2016 18:49:47 -0700 Subject: [PATCH 1/2] [Transforms] Add test from fixing 8256 into transforms branch (#8294) * Update baselines * Add tests * Update baselines from merging with transforms --- .../defaultExportInAwaitExpression01.js | 53 +++++++++++++++++++ .../defaultExportInAwaitExpression01.symbols | 22 ++++++++ .../defaultExportInAwaitExpression01.types | 31 +++++++++++ .../defaultExportInAwaitExpression02.js | 35 ++++++++++++ .../defaultExportInAwaitExpression02.symbols | 22 ++++++++ .../defaultExportInAwaitExpression02.types | 31 +++++++++++ .../defaultExportInAwaitExpression01.ts | 12 +++++ .../defaultExportInAwaitExpression02.ts | 12 +++++ 8 files changed, 218 insertions(+) create mode 100644 tests/baselines/reference/defaultExportInAwaitExpression01.js create mode 100644 tests/baselines/reference/defaultExportInAwaitExpression01.symbols create mode 100644 tests/baselines/reference/defaultExportInAwaitExpression01.types create mode 100644 tests/baselines/reference/defaultExportInAwaitExpression02.js create mode 100644 tests/baselines/reference/defaultExportInAwaitExpression02.symbols create mode 100644 tests/baselines/reference/defaultExportInAwaitExpression02.types create mode 100644 tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts create mode 100644 tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.js b/tests/baselines/reference/defaultExportInAwaitExpression01.js new file mode 100644 index 00000000000..b57b6237d7a --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.js @@ -0,0 +1,53 @@ +//// [tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts] //// + +//// [a.ts] +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +//// [b.ts] +import x from './a'; + +( async function() { + const value = await x; +}() ); + + +//// [a.js] +(function (dependencies, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(dependencies, factory); + } +})(["require", "exports"], function (require, exports) { + "use strict"; + const x = new Promise((resolve, reject) => { resolve({}); }); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = x; +}); +//// [b.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +(function (dependencies, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; + } + else if (typeof define === 'function' && define.amd) { + define(dependencies, factory); + } +})(["require", "exports", "./a"], function (require, exports) { + "use strict"; + const a_1 = require("./a"); + (function () { + return __awaiter(this, void 0, void 0, function* () { + const value = yield a_1.default; + }); + }()); +}); diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.symbols b/tests/baselines/reference/defaultExportInAwaitExpression01.symbols new file mode 100644 index 00000000000..eb833f63895 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Symbol(x, Decl(a.ts, 0, 5)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) +>reject : Symbol(reject, Decl(a.ts, 0, 33)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) + +export default x; +>x : Symbol(x, Decl(a.ts, 0, 5)) + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Symbol(x, Decl(b.ts, 0, 6)) + +( async function() { + const value = await x; +>value : Symbol(value, Decl(b.ts, 3, 9)) +>x : Symbol(x, Decl(b.ts, 0, 6)) + +}() ); + diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.types b/tests/baselines/reference/defaultExportInAwaitExpression01.types new file mode 100644 index 00000000000..1f7de76b90e --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Promise<{}> +>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> +>Promise : PromiseConstructor +>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +>resolve( {} ) : void +>resolve : (value?: {} | PromiseLike<{}>) => void +>{} : {} + +export default x; +>x : Promise<{}> + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Promise<{}> + +( async function() { +>( async function() { const value = await x;}() ) : Promise +>async function() { const value = await x;}() : Promise +>async function() { const value = await x;} : () => Promise + + const value = await x; +>value : {} +>await x : {} +>x : Promise<{}> + +}() ); + diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.js b/tests/baselines/reference/defaultExportInAwaitExpression02.js new file mode 100644 index 00000000000..db2150c66f1 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts] //// + +//// [a.ts] +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +//// [b.ts] +import x from './a'; + +( async function() { + const value = await x; +}() ); + + +//// [a.js] +"use strict"; +const x = new Promise((resolve, reject) => { resolve({}); }); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = x; +//// [b.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +const a_1 = require("./a"); +(function () { + return __awaiter(this, void 0, void 0, function* () { + const value = yield a_1.default; + }); +}()); diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.symbols b/tests/baselines/reference/defaultExportInAwaitExpression02.symbols new file mode 100644 index 00000000000..eb833f63895 --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Symbol(x, Decl(a.ts, 0, 5)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) +>reject : Symbol(reject, Decl(a.ts, 0, 33)) +>resolve : Symbol(resolve, Decl(a.ts, 0, 24)) + +export default x; +>x : Symbol(x, Decl(a.ts, 0, 5)) + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Symbol(x, Decl(b.ts, 0, 6)) + +( async function() { + const value = await x; +>value : Symbol(value, Decl(b.ts, 3, 9)) +>x : Symbol(x, Decl(b.ts, 0, 6)) + +}() ); + diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.types b/tests/baselines/reference/defaultExportInAwaitExpression02.types new file mode 100644 index 00000000000..1f7de76b90e --- /dev/null +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/modules/a.ts === +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +>x : Promise<{}> +>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> +>Promise : PromiseConstructor +>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +>resolve( {} ) : void +>resolve : (value?: {} | PromiseLike<{}>) => void +>{} : {} + +export default x; +>x : Promise<{}> + +=== tests/cases/conformance/es6/modules/b.ts === +import x from './a'; +>x : Promise<{}> + +( async function() { +>( async function() { const value = await x;}() ) : Promise +>async function() { const value = await x;}() : Promise +>async function() { const value = await x;} : () => Promise + + const value = await x; +>value : {} +>await x : {} +>x : Promise<{}> + +}() ); + diff --git a/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts new file mode 100644 index 00000000000..45f15423016 --- /dev/null +++ b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts @@ -0,0 +1,12 @@ +// @target: ES6 +// @module: umd +// @filename: a.ts +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +// @filename: b.ts +import x from './a'; + +( async function() { + const value = await x; +}() ); diff --git a/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts new file mode 100644 index 00000000000..cd878540a3c --- /dev/null +++ b/tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts @@ -0,0 +1,12 @@ +// @target: ES6 +// @module: commonjs +// @filename: a.ts +const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); +export default x; + +// @filename: b.ts +import x from './a'; + +( async function() { + const value = await x; +}() ); From 73fb8a06121f6730f5edd3ab5695b242854bf7ff Mon Sep 17 00:00:00 2001 From: Yui Date: Tue, 26 Apr 2016 11:39:04 -0700 Subject: [PATCH 2/2] Filter library text from RWC output (#8297) --- src/harness/rwcRunner.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 8c3b3c70a1f..39231435bf5 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -190,8 +190,9 @@ namespace RWC { if (compilerResult.errors.length === 0) { return null; } - - return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors); + // Do not include the library in the baselines to avoid noise + const baselineFiles = inputFiles.concat(otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName)); + return Harness.Compiler.getErrorBaseline(baselineFiles, compilerResult.errors); }, false, baselineOpts); });