From 07a94984e1e3ca24dcaf114ac5ff82c8c3510894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Feb 2024 20:10:24 +0100 Subject: [PATCH] chore: remove opcall_test.ts (#22227) This test should be in `deno_core`. Ref https://github.com/denoland/deno_core/issues/533 --- cli/tests/integration/js_unit_tests.rs | 1 - cli/tests/unit/opcall_test.ts | 77 -------------------------- 2 files changed, 78 deletions(-) delete mode 100644 cli/tests/unit/opcall_test.ts diff --git a/cli/tests/integration/js_unit_tests.rs b/cli/tests/integration/js_unit_tests.rs index 15d377aaa4..00e26cc91b 100644 --- a/cli/tests/integration/js_unit_tests.rs +++ b/cli/tests/integration/js_unit_tests.rs @@ -59,7 +59,6 @@ util::unit_test_factory!( navigator_test, net_test, network_interfaces_test, - opcall_test, os_test, ops_test, path_from_url_test, diff --git a/cli/tests/unit/opcall_test.ts b/cli/tests/unit/opcall_test.ts deleted file mode 100644 index 964dc28421..0000000000 --- a/cli/tests/unit/opcall_test.ts +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -import { assertEquals } from "../../../test_util/std/assert/mod.ts"; -import { assert, assertStringIncludes, unreachable } from "./test_util.ts"; - -Deno.test(async function sendAsyncStackTrace() { - try { - await core.ops.op_error_async(); - unreachable(); - } catch (error) { - assert(error instanceof Error); - const s = error.stack?.toString(); - assert(s); - assertStringIncludes(s, "opcall_test.ts"); - assertStringIncludes(s, "sendAsyncStackTrace"); - assert( - !s.includes("ext:core"), - "opcall stack traces should NOT include ext:core internals such as unwrapOpResult", - ); - } -}); - -Deno.test(async function sendAsyncStackTraceDeferred() { - try { - await core.ops.op_error_async_deferred(); - unreachable(); - } catch (error) { - assert(error instanceof Error); - const s = error.stack?.toString(); - assert(s); - assertStringIncludes(s, "opcall_test.ts"); - assertStringIncludes(s, "sendAsyncStackTraceDeferred"); - assert( - !s.includes("ext:core"), - "opcall stack traces should NOT include ext:core internals such as unwrapOpResult", - ); - } -}); - -Deno.test(function syncAdd() { - assertEquals(30, core.ops.op_add(10, 20)); -}); - -Deno.test(async function asyncAdd() { - assertEquals(30, await core.ops.op_add_async(10, 20)); -}); - -// @ts-ignore This is not publicly typed namespace, but it's there for sure. -const core = Deno[Deno.internal].core; - -Deno.test(async function opsAsyncBadResource() { - try { - const nonExistingRid = 9999; - await core.read( - nonExistingRid, - new Uint8Array(0), - ); - } catch (e) { - if (!(e instanceof Deno.errors.BadResource)) { - throw e; - } - } -}); - -Deno.test(function opsSyncBadResource() { - try { - const nonExistingRid = 9999; - core.ops.op_read_sync( - nonExistingRid, - new Uint8Array(0), - ); - } catch (e) { - if (!(e instanceof Deno.errors.BadResource)) { - throw e; - } - } -});