From 46b1c653c0c433932908b7610f60b409af134c76 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 12 Apr 2021 21:55:05 +0200 Subject: refactor(deno): remove concept of bin & json ops (#10145) --- cli/tests/unit/dispatch_bin_test.ts | 48 ------------------------------------- cli/tests/unit/dispatch_test.ts | 48 +++++++++++++++++++++++++++++++++++++ cli/tests/unit/unit_tests.ts | 2 +- 3 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 cli/tests/unit/dispatch_bin_test.ts create mode 100644 cli/tests/unit/dispatch_test.ts (limited to 'cli/tests/unit') diff --git a/cli/tests/unit/dispatch_bin_test.ts b/cli/tests/unit/dispatch_bin_test.ts deleted file mode 100644 index 01f29d0bc..000000000 --- a/cli/tests/unit/dispatch_bin_test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { assertStringIncludes, unitTest, unreachable } from "./test_util.ts"; - -unitTest(async function sendAsyncStackTrace() { - const buf = new Uint8Array(10); - const rid = 10; - try { - await Deno.read(rid, buf); - unreachable(); - } catch (error) { - const s = error.stack.toString(); - console.log(s); - assertStringIncludes(s, "dispatch_bin_test.ts"); - assertStringIncludes(s, "read"); - } -}); - -declare global { - namespace Deno { - // deno-lint-ignore no-explicit-any - var core: any; // eslint-disable-line no-var - } -} - -unitTest(async function binOpsAsyncBadResource(): Promise { - try { - const nonExistingRid = 9999; - await Deno.core.binOpAsync( - "op_read_async", - nonExistingRid, - new Uint8Array(0), - ); - } catch (e) { - if (!(e instanceof Deno.errors.BadResource)) { - throw e; - } - } -}); - -unitTest(function binOpsSyncBadResource(): void { - try { - const nonExistingRid = 9999; - Deno.core.binOpSync("op_read_sync", nonExistingRid, new Uint8Array(0)); - } catch (e) { - if (!(e instanceof Deno.errors.BadResource)) { - throw e; - } - } -}); diff --git a/cli/tests/unit/dispatch_test.ts b/cli/tests/unit/dispatch_test.ts new file mode 100644 index 000000000..6805d1af7 --- /dev/null +++ b/cli/tests/unit/dispatch_test.ts @@ -0,0 +1,48 @@ +import { assertStringIncludes, unitTest, unreachable } from "./test_util.ts"; + +unitTest(async function sendAsyncStackTrace() { + const buf = new Uint8Array(10); + const rid = 10; + try { + await Deno.read(rid, buf); + unreachable(); + } catch (error) { + const s = error.stack.toString(); + console.log(s); + assertStringIncludes(s, "dispatch_test.ts"); + assertStringIncludes(s, "read"); + } +}); + +declare global { + namespace Deno { + // deno-lint-ignore no-explicit-any + var core: any; // eslint-disable-line no-var + } +} + +unitTest(async function opsAsyncBadResource(): Promise { + try { + const nonExistingRid = 9999; + await Deno.core.opAsync( + "op_read_async", + nonExistingRid, + new Uint8Array(0), + ); + } catch (e) { + if (!(e instanceof Deno.errors.BadResource)) { + throw e; + } + } +}); + +unitTest(function opsSyncBadResource(): void { + try { + const nonExistingRid = 9999; + Deno.core.opSync("op_read_sync", nonExistingRid, new Uint8Array(0)); + } catch (e) { + if (!(e instanceof Deno.errors.BadResource)) { + throw e; + } + } +}); diff --git a/cli/tests/unit/unit_tests.ts b/cli/tests/unit/unit_tests.ts index 0dcbfe80b..ebf87651d 100644 --- a/cli/tests/unit/unit_tests.ts +++ b/cli/tests/unit/unit_tests.ts @@ -15,7 +15,7 @@ import "./console_test.ts"; import "./copy_file_test.ts"; import "./custom_event_test.ts"; import "./dir_test.ts"; -import "./dispatch_bin_test.ts"; +import "./dispatch_test.ts"; import "./error_stack_test.ts"; import "./event_test.ts"; import "./event_target_test.ts"; -- cgit v1.2.3