diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/bench_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/integration/lsp_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/testdata/bench/explicit_start_and_end.out | 25 | ||||
-rw-r--r-- | cli/tests/testdata/bench/explicit_start_and_end.ts | 50 | ||||
-rw-r--r-- | cli/tests/testdata/check/deno_unstable_not_found/main.out | 2 |
5 files changed, 83 insertions, 2 deletions
diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 0ba297e63..73d541aa6 100644 --- a/cli/tests/integration/bench_tests.rs +++ b/cli/tests/integration/bench_tests.rs @@ -181,6 +181,12 @@ itest!(check_local_by_default2 { exit_code: 1, }); +itest!(bench_explicit_start_end { + args: "bench --quiet -A bench/explicit_start_and_end.ts", + output: "bench/explicit_start_and_end.out", + exit_code: 1, +}); + itest!(bench_with_config { args: "bench --config bench/collect/deno.jsonc bench/collect", exit_code: 0, diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 15ede69ea..22951825b 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -5130,7 +5130,7 @@ fn lsp_completions_auto_import() { "source": "./b.ts", "data": { "exportName": "foo", - "exportMapKey": "foo|6802|file:///a/b", + "exportMapKey": "foo|6811|file:///a/b", "moduleSpecifier": "./b.ts", "fileName": "file:///a/b.ts" }, diff --git a/cli/tests/testdata/bench/explicit_start_and_end.out b/cli/tests/testdata/bench/explicit_start_and_end.out new file mode 100644 index 000000000..89df85a42 --- /dev/null +++ b/cli/tests/testdata/bench/explicit_start_and_end.out @@ -0,0 +1,25 @@ +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/explicit_start_and_end.ts +benchmark time (avg) (min … max) p75 p99 p995 +----------------------------------------------------- ----------------------------- +start and end [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +start only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +end only [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] +double start error: TypeError: BenchContext::start() has already been invoked. + t.start(); + ^ + at BenchContext.start ([WILDCARD]) + at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD] +double end error: TypeError: BenchContext::end() has already been invoked. + t.end(); + ^ + at BenchContext.end ([WILDCARD]) + at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD] +captured error: TypeError: The benchmark which this context belongs to is not being executed. + captured!.start(); + ^ + at BenchContext.start ([WILDCARD]) + at [WILDCARD]/explicit_start_and_end.ts:[WILDCARD] +error: Bench failed diff --git a/cli/tests/testdata/bench/explicit_start_and_end.ts b/cli/tests/testdata/bench/explicit_start_and_end.ts new file mode 100644 index 000000000..60a3d10d7 --- /dev/null +++ b/cli/tests/testdata/bench/explicit_start_and_end.ts @@ -0,0 +1,50 @@ +Deno.bench("start and end", (t) => { + const id = setInterval(() => {}, 1000); + t.start(); + Deno.inspect(id); + t.end(); + clearInterval(id); +}); + +Deno.bench("start only", (t) => { + const id = setInterval(() => {}, 1000); + t.start(); + Deno.inspect(id); + clearInterval(id); +}); + +Deno.bench("end only", (t) => { + const id = setInterval(() => {}, 1000); + Deno.inspect(id); + t.end(); + clearInterval(id); +}); + +Deno.bench("double start", (t) => { + const id = setInterval(() => {}, 1000); + t.start(); + t.start(); + Deno.inspect(id); + t.end(); + clearInterval(id); +}); + +let captured: Deno.BenchContext; + +Deno.bench("double end", (t) => { + captured = t; + const id = setInterval(() => {}, 1000); + t.start(); + Deno.inspect(id); + t.end(); + t.end(); + clearInterval(id); +}); + +Deno.bench("captured", () => { + const id = setInterval(() => {}, 1000); + captured!.start(); + Deno.inspect(id); + captured!.end(); + clearInterval(id); +}); diff --git a/cli/tests/testdata/check/deno_unstable_not_found/main.out b/cli/tests/testdata/check/deno_unstable_not_found/main.out index dfe3cf317..dcc646622 100644 --- a/cli/tests/testdata/check/deno_unstable_not_found/main.out +++ b/cli/tests/testdata/check/deno_unstable_not_found/main.out @@ -6,7 +6,7 @@ Deno.openKv; 'open' is declared here. export function open( ~~~~ - at asset:///lib.deno.ns.d.ts:1667:19 + at asset:///lib.deno.ns.d.ts:[WILDCARD]:19 TS2339 [ERROR]: Property 'createHttpClient' does not exist on type 'typeof Deno'. 'Deno.createHttpClient' is an unstable API. Did you forget to run with the '--unstable' flag? If not, try changing the 'lib' compiler option to include 'deno.unstable' or add a triple-slash directive to your entrypoint: /// <reference lib="deno.unstable" /> Deno.createHttpClient; |