summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorInteon <42113979+inteon@users.noreply.github.com>2021-04-08 18:04:02 +0200
committerGitHub <noreply@github.com>2021-04-08 18:04:02 +0200
commitd050b491b10fe37b4461b37c56028a14c8674c95 (patch)
tree47aa768f3027dff90ffd1aacdd267274610bf441 /cli/tests
parentc4b21fbff119a8ce006391d8fb7586877759bcef (diff)
fix(core): error handling in examples (#9867)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/dispatch_bin_test.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/tests/unit/dispatch_bin_test.ts b/cli/tests/unit/dispatch_bin_test.ts
index 83053461d..ca1864621 100644
--- a/cli/tests/unit/dispatch_bin_test.ts
+++ b/cli/tests/unit/dispatch_bin_test.ts
@@ -32,3 +32,29 @@ declare global {
var core: any; // eslint-disable-line no-var
}
}
+
+unitTest(async function binOpsAsyncBadResource(): Promise<void> {
+ 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;
+ }
+ }
+});