From 3d9302808812ebd7a736f6ae892cab27d724fa79 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 5 Oct 2024 12:37:23 -0500 Subject: [PATCH] Test bundle --- examples/sample-bad-bundle/badmod.janet | 1 + examples/sample-bad-bundle/bundle.janet | 7 +++++++ test/suite-bundle.janet | 5 +++++ 3 files changed, 13 insertions(+) create mode 100644 examples/sample-bad-bundle/badmod.janet create mode 100644 examples/sample-bad-bundle/bundle.janet diff --git a/examples/sample-bad-bundle/badmod.janet b/examples/sample-bad-bundle/badmod.janet new file mode 100644 index 00000000..bae8931b --- /dev/null +++ b/examples/sample-bad-bundle/badmod.janet @@ -0,0 +1 @@ +(def abc 123) diff --git a/examples/sample-bad-bundle/bundle.janet b/examples/sample-bad-bundle/bundle.janet new file mode 100644 index 00000000..a27c6984 --- /dev/null +++ b/examples/sample-bad-bundle/bundle.janet @@ -0,0 +1,7 @@ +(defn install + [manifest &] + (bundle/add-file manifest "badmod.janet")) + +(defn check + [&] + (error "Check failed!")) diff --git a/test/suite-bundle.janet b/test/suite-bundle.janet index a0f4c031..f860c1fd 100644 --- a/test/suite-bundle.janet +++ b/test/suite-bundle.janet @@ -117,6 +117,11 @@ (assert (= 0 (length (bundle/list))) "bundles are listed correctly 7") (assert (= 0 (length (bundle/topolist))) "bundles are listed correctly 8") +# Try installing a bundle that fails check +(assert-error "bad test" (bundle/install "./examples/sample-bad-bundle" :check true)) +(assert (= 0 (length (bundle/list))) "check failure 0") +(assert (= 0 (length (bundle/topolist))) "check failure 1") + (rmrf syspath) (end-suite)