1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

Add async tests from prototype

This commit is contained in:
Ryan Dahl 2018-08-10 15:16:41 -04:00
parent c7ce450ee9
commit 4772c14d12
4 changed files with 33 additions and 0 deletions

11
tests/012_async.ts Normal file
View file

@ -0,0 +1,11 @@
// Check that we can use the async keyword.
async function main() {
await new Promise((resolve, reject) => {
console.log("2");
setTimeout(resolve, 100);
});
console.log("3");
}
console.log("1");
main();

3
tests/012_async.ts.out Normal file
View file

@ -0,0 +1,3 @@
1
2
3

9
tests/async_error.ts Normal file
View file

@ -0,0 +1,9 @@
console.log("hello");
const foo = async () => {
console.log("before error");
throw Error("error");
}
foo();
console.log("world");

10
tests/async_error.ts.out Normal file
View file

@ -0,0 +1,10 @@
hello
before error
Error: error
at foo ([WILDCARD]tests/async_error.ts:5:9)
at eval ([WILDCARD]tests/async_error.ts:8:1)
at eval (<anonymous>)
at execute (deno/js/runtime.ts:[WILDCARD])
at FileModule.compileAndRun (deno/js/runtime.ts:[WILDCARD])
at denoMain (deno/js/main.ts:[WILDCARD])
at deno_main.js:1:1