summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/045_proxy_client.ts8
-rw-r--r--cli/tests/045_proxy_test.ts12
-rw-r--r--cli/tests/integration_tests.rs10
-rw-r--r--cli/tests/top_level_for_await.js10
-rw-r--r--cli/tests/top_level_for_await.out3
-rw-r--r--cli/tests/top_level_for_await.ts10
6 files changed, 39 insertions, 14 deletions
diff --git a/cli/tests/045_proxy_client.ts b/cli/tests/045_proxy_client.ts
index 3d7003750..221ac57f6 100644
--- a/cli/tests/045_proxy_client.ts
+++ b/cli/tests/045_proxy_client.ts
@@ -1,7 +1,3 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-async function main(): Promise<void> {
- const res = await fetch("http://localhost:4545/std/examples/colors.ts");
- console.log(`Response http: ${await res.text()}`);
-}
-
-main();
+const res = await fetch("http://localhost:4545/std/examples/colors.ts");
+console.log(`Response http: ${await res.text()}`);
diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts
index 0e7225b3f..98225dbf1 100644
--- a/cli/tests/045_proxy_test.ts
+++ b/cli/tests/045_proxy_test.ts
@@ -55,11 +55,7 @@ async function testModuleDownload(): Promise<void> {
http.close();
}
-async function main(): Promise<void> {
- proxyServer();
- await testFetch();
- await testModuleDownload();
- Deno.exit(0);
-}
-
-main();
+proxyServer();
+await testFetch();
+await testModuleDownload();
+Deno.exit(0);
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index ee8f1384c..09f148736 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -597,3 +597,13 @@ itest!(top_level_await_ts {
args: "--allow-read top_level_await.ts",
output: "top_level_await.out",
});
+
+itest!(top_level_for_await {
+ args: "top_level_for_await.js",
+ output: "top_level_for_await.out",
+});
+
+itest!(top_level_for_await_ts {
+ args: "top_level_for_await.ts",
+ output: "top_level_for_await.out",
+});
diff --git a/cli/tests/top_level_for_await.js b/cli/tests/top_level_for_await.js
new file mode 100644
index 000000000..fa3b496a8
--- /dev/null
+++ b/cli/tests/top_level_for_await.js
@@ -0,0 +1,10 @@
+async function* asyncGenerator() {
+ let i = 0;
+ while (i < 3) {
+ yield i++;
+ }
+}
+
+for await (const num of asyncGenerator()) {
+ console.log(num);
+};
diff --git a/cli/tests/top_level_for_await.out b/cli/tests/top_level_for_await.out
new file mode 100644
index 000000000..4539bbf2d
--- /dev/null
+++ b/cli/tests/top_level_for_await.out
@@ -0,0 +1,3 @@
+0
+1
+2
diff --git a/cli/tests/top_level_for_await.ts b/cli/tests/top_level_for_await.ts
new file mode 100644
index 000000000..9179322d7
--- /dev/null
+++ b/cli/tests/top_level_for_await.ts
@@ -0,0 +1,10 @@
+async function* asyncGenerator(): AsyncIterableIterator<number> {
+ let i = 0;
+ while (i < 3) {
+ yield i++;
+ }
+}
+
+for await (const num of asyncGenerator()) {
+ console.log(num);
+}