Skip to content

Commit b472e9a

Browse files
committed
Add baselines for new tests
1 parent 680d182 commit b472e9a

File tree

6 files changed

+68
-3
lines changed

6 files changed

+68
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ==ORIGINAL==
2+
3+
function /*[#|*/innerPromise/*|]*/(): Promise<string> {
4+
return fetch("https://typescriptlang.org").then(resp => {
5+
return resp.blob().then(({ blob }: { blob: { byteOffset: number } }) => [0, blob.byteOffset]).catch(({ message }: Error) => ['Error ', message]);
6+
}).then(([x, y]) => {
7+
return (x || y).toString();
8+
});
9+
}
10+
11+
// ==ASYNC FUNCTION::Convert to async function==
12+
13+
async function innerPromise(): Promise<string> {
14+
const resp = await fetch("https://typescriptlang.org");
15+
let result: any[];
16+
try {
17+
const { blob } = await resp.blob();
18+
result = [0, blob.byteOffset];
19+
}
20+
catch ({ message }) {
21+
result = ['Error ', message];
22+
}
23+
const [x, y] = result;
24+
return (x || y).toString();
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ==ORIGINAL==
2+
3+
function /*[#|*/f/*|]*/() {
4+
return Promise.resolve().then(() => ({ x: 3 })).catch(() => ({ x: "a" })).then(({ x }) => !!x);
5+
}
6+
7+
// ==ASYNC FUNCTION::Convert to async function==
8+
9+
async function f() {
10+
let result;
11+
try {
12+
await Promise.resolve();
13+
result = ({ x: 3 });
14+
}
15+
catch (e) {
16+
result = ({ x: "a" });
17+
}
18+
const { x } = result;
19+
return !!x;
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ==ORIGINAL==
2+
3+
function /*[#|*/f/*|]*/() {
4+
return Promise.resolve().then(() => ({ x: 3 })).catch(() => ({ x: "a" })).then(({ x }) => !!x);
5+
}
6+
7+
// ==ASYNC FUNCTION::Convert to async function==
8+
9+
async function f() {
10+
let result: { x: number; } | { x: string; };
11+
try {
12+
await Promise.resolve();
13+
result = ({ x: 3 });
14+
}
15+
catch (e) {
16+
result = ({ x: "a" });
17+
}
18+
const { x } = result;
19+
return !!x;
20+
}

0 commit comments

Comments
 (0)