From 260084ccbf053485d00d5b6ebc804252c409be49 Mon Sep 17 00:00:00 2001 From: Gudmund Vatn Date: Fri, 17 Apr 2020 12:51:10 +0200 Subject: Add close method to Plugin (#4670) (#4785) --- test_plugin/tests/test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test_plugin/tests/test.js') diff --git a/test_plugin/tests/test.js b/test_plugin/tests/test.js index d6d531f14..d34624f09 100644 --- a/test_plugin/tests/test.js +++ b/test_plugin/tests/test.js @@ -13,6 +13,10 @@ if (Deno.build.os === "mac") { const filename = `../target/${Deno.args[0]}/${filenamePrefix}${filenameBase}${filenameSuffix}`; +// This will be checked against open resources after Plugin.close() +// in runTestClose() below. +const resourcesPre = Deno.resources(); + const plugin = Deno.openPlugin(filename); const { testSync, testAsync } = plugin.ops; @@ -60,7 +64,22 @@ function runTestOpCount() { } } +function runTestPluginClose() { + plugin.close(); + + const resourcesPost = Deno.resources(); + + const preStr = JSON.stringify(resourcesPre, null, 2); + const postStr = JSON.stringify(resourcesPost, null, 2); + if (preStr !== postStr) { + throw new Error(`Difference in open resources before openPlugin and after Plugin.close(): +Before: ${preStr} +After: ${postStr}`); + } +} + runTestSync(); runTestAsync(); runTestOpCount(); +runTestPluginClose(); -- cgit v1.2.3