-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_test.ts
More file actions
49 lines (39 loc) · 726 Bytes
/
Copy pathmod_test.ts
File metadata and controls
49 lines (39 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { assertEquals } from "@std/assert";
import { clone, rc } from "./mod.ts";
Deno.test("dispose clone", () => {
let called = 0;
const a = {
[Symbol.dispose]() {
called += 1;
},
};
const a1 = rc(a);
const a2 = a1[clone]();
{
using _a = a1;
}
assertEquals(called, 0);
{
using _a = a2;
}
assertEquals(called, 1);
});
Deno.test("asyncDispose clone", async () => {
let called = 0;
const a = {
// deno-lint-ignore require-await
async [Symbol.asyncDispose]() {
called += 1;
},
};
const a1 = rc(a);
const a2 = a1[clone]();
{
await using _a = a1;
}
assertEquals(called, 0);
{
await using _a = a2;
}
assertEquals(called, 1);
});