-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
23 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
console.log(0) | ||
console.log([function foo() {}, function baz() {}, a => {}]) | ||
console.log(0); | ||
console.log([function foo() {}, function baz() {}, (a) => {}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
console.log ("1") | ||
console.log('1'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
console.log({a:1}) | ||
console.log({a: 1}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. | ||
import { test, runIfMain } from "../testing/mod.ts"; | ||
import { assertEquals } from "../testing/asserts.ts"; | ||
import { Latch, deferred } from "./async.ts"; | ||
import { Channel, deferred } from "./async.ts"; | ||
|
||
test(async function asyncDeferred(): Promise<void> { | ||
const d = deferred<number>(); | ||
d.resolve(12); | ||
}); | ||
|
||
async function send3(latch: Latch<number>): Promise<void> { | ||
await latch.send(1); | ||
await latch.send(2); | ||
await latch.send(3); | ||
async function send3(channel: Channel<number>): Promise<void> { | ||
await channel.send(1); | ||
await channel.send(2); | ||
await channel.send(3); | ||
} | ||
|
||
test(async function asyncLatch(): Promise<void> { | ||
const latch = new Latch<number>(); | ||
send3(latch); | ||
test(async function asyncChannel(): Promise<void> { | ||
const channel = new Channel<number>(); | ||
send3(channel); | ||
|
||
assertEquals(1, await latch.recv()); | ||
assertEquals(2, await latch.recv()); | ||
assertEquals(3, await latch.recv()); | ||
let _lastPromise = latch.recv(); | ||
assertEquals(1, await channel.recv()); | ||
assertEquals(2, await channel.recv()); | ||
assertEquals(3, await channel.recv()); | ||
let _lastPromise = channel.recv(); | ||
}); | ||
|
||
runIfMain(import.meta); |