diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2024-04-29 10:08:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 10:08:27 -0400 |
| commit | da52058a945999d486b07700d2834f027a65947c (patch) | |
| tree | b6031c274cbc36dcefc6d681473e366cdb208c89 /tests/specs/bench/load_unload | |
| parent | b02ffec37c73be8a73b95b33b32efa693e84e01b (diff) | |
chore: migrate bench, publish, and more itests to spec tests (#23584)
Diffstat (limited to 'tests/specs/bench/load_unload')
| -rw-r--r-- | tests/specs/bench/load_unload/__test__.jsonc | 5 | ||||
| -rw-r--r-- | tests/specs/bench/load_unload/load_unload.out | 8 | ||||
| -rw-r--r-- | tests/specs/bench/load_unload/load_unload.ts | 22 |
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/specs/bench/load_unload/__test__.jsonc b/tests/specs/bench/load_unload/__test__.jsonc new file mode 100644 index 000000000..8837d3d80 --- /dev/null +++ b/tests/specs/bench/load_unload/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bench load_unload.ts", + "output": "load_unload.out", + "exitCode": 0 +} diff --git a/tests/specs/bench/load_unload/load_unload.out b/tests/specs/bench/load_unload/load_unload.out new file mode 100644 index 000000000..99e4389ac --- /dev/null +++ b/tests/specs/bench/load_unload/load_unload.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/load_unload.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/load_unload.ts +benchmark time (avg) iter/s (min … max) p75 p99 p995 +--------------------------------------------------------------- ----------------------------- +bench [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] diff --git a/tests/specs/bench/load_unload/load_unload.ts b/tests/specs/bench/load_unload/load_unload.ts new file mode 100644 index 000000000..3653c135d --- /dev/null +++ b/tests/specs/bench/load_unload/load_unload.ts @@ -0,0 +1,22 @@ +let interval: number | null = null; +addEventListener("load", () => { + if (interval) { + throw new Error("Interval is already set"); + } + + interval = setInterval(() => {}, 0); +}); + +addEventListener("unload", () => { + if (!interval) { + throw new Error("Interval was not set"); + } + + clearInterval(interval); +}); + +Deno.bench("bench", () => { + if (!interval) { + throw new Error("Interval was not set"); + } +}); |
