From 7de86ab605ee94fdbce351c7f3031816c935c393 Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Thu, 14 May 2020 03:59:56 -0700 Subject: cli: don't panic on Deno.close invalid argument (#5320) --- cli/js/tests/resources_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli/js/tests') diff --git a/cli/js/tests/resources_test.ts b/cli/js/tests/resources_test.ts index 680fac8b7..385905a6e 100644 --- a/cli/js/tests/resources_test.ts +++ b/cli/js/tests/resources_test.ts @@ -1,6 +1,16 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { unitTest, assertEquals, assert } from "./test_util.ts"; +unitTest(function resourcesCloseBadArgs(): void { + let err; + try { + Deno.close((null as unknown) as number); + } catch (e) { + err = e; + } + assert(err instanceof Deno.errors.InvalidData); +}); + unitTest(function resourcesStdio(): void { const res = Deno.resources(); -- cgit v1.2.3