Added test for scenario.
This commit is contained in:
parent
810a680d3a
commit
899ce32b08
4 changed files with 74 additions and 0 deletions
28
tests/baselines/reference/generatorTransformFinalLabel.js
Normal file
28
tests/baselines/reference/generatorTransformFinalLabel.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
//// [generatorTransformFinalLabel.ts]
|
||||
async function test(skip: boolean) {
|
||||
if (!skip) {
|
||||
await 1
|
||||
}
|
||||
else {
|
||||
throw Error('test')
|
||||
}
|
||||
}
|
||||
|
||||
//// [generatorTransformFinalLabel.js]
|
||||
function test(skip) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!!skip)
|
||||
return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, 1];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [3 /*break*/, 3];
|
||||
case 2: throw Error('test');
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
=== tests/cases/compiler/generatorTransformFinalLabel.ts ===
|
||||
async function test(skip: boolean) {
|
||||
>test : Symbol(test, Decl(generatorTransformFinalLabel.ts, 0, 0))
|
||||
>skip : Symbol(skip, Decl(generatorTransformFinalLabel.ts, 0, 20))
|
||||
|
||||
if (!skip) {
|
||||
>skip : Symbol(skip, Decl(generatorTransformFinalLabel.ts, 0, 20))
|
||||
|
||||
await 1
|
||||
}
|
||||
else {
|
||||
throw Error('test')
|
||||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
}
|
20
tests/baselines/reference/generatorTransformFinalLabel.types
Normal file
20
tests/baselines/reference/generatorTransformFinalLabel.types
Normal file
|
@ -0,0 +1,20 @@
|
|||
=== tests/cases/compiler/generatorTransformFinalLabel.ts ===
|
||||
async function test(skip: boolean) {
|
||||
>test : (skip: boolean) => Promise<void>
|
||||
>skip : boolean
|
||||
|
||||
if (!skip) {
|
||||
>!skip : boolean
|
||||
>skip : boolean
|
||||
|
||||
await 1
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
}
|
||||
else {
|
||||
throw Error('test')
|
||||
>Error('test') : Error
|
||||
>Error : ErrorConstructor
|
||||
>'test' : "test"
|
||||
}
|
||||
}
|
11
tests/cases/compiler/generatorTransformFinalLabel.ts
Normal file
11
tests/cases/compiler/generatorTransformFinalLabel.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
// @target: es5
|
||||
// @lib: es5,es6
|
||||
// @noEmitHelpers: true
|
||||
async function test(skip: boolean) {
|
||||
if (!skip) {
|
||||
await 1
|
||||
}
|
||||
else {
|
||||
throw Error('test')
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue