mirror of
https://github.com/janet-lang/janet
synced 2024-12-24 07:20:27 +00:00
Add some test usage for the sample bundle.
This commit is contained in:
parent
7d8af2f99a
commit
2260a593bd
@ -0,0 +1,3 @@
|
|||||||
|
(defn function
|
||||||
|
[x]
|
||||||
|
(+ x x))
|
@ -0,0 +1,3 @@
|
|||||||
|
(defn install
|
||||||
|
[manifest &]
|
||||||
|
(bundle/add-file manifest "dep2.janet"))
|
@ -35,9 +35,10 @@
|
|||||||
nil)
|
nil)
|
||||||
|
|
||||||
# Setup a temporary syspath for manipultation
|
# Setup a temporary syspath for manipultation
|
||||||
(def syspath (string "./" (gensym) "_jpm_tree.tmp"))
|
(def syspath (string "./" (string (math/random)) "_jpm_tree.tmp"))
|
||||||
|
(rmrf syspath)
|
||||||
(os/mkdir syspath)
|
(os/mkdir syspath)
|
||||||
(setdyn *syspath* (os/realpath syspath))
|
(put root-env *syspath* (os/realpath syspath))
|
||||||
(setdyn *out* @"")
|
(setdyn *out* @"")
|
||||||
(assert (empty? (bundle/list)) "initial bundle/list")
|
(assert (empty? (bundle/list)) "initial bundle/list")
|
||||||
(assert (empty? (bundle/topolist)) "initial bundle/topolist")
|
(assert (empty? (bundle/topolist)) "initial bundle/topolist")
|
||||||
@ -74,6 +75,10 @@
|
|||||||
(assert (= 3 (length (bundle/list))) "bundles are listed correctly 3")
|
(assert (= 3 (length (bundle/list))) "bundles are listed correctly 3")
|
||||||
(assert (= 3 (length (bundle/topolist))) "bundles are listed correctly 4")
|
(assert (= 3 (length (bundle/topolist))) "bundles are listed correctly 4")
|
||||||
|
|
||||||
|
# Check that we can import the main dependency
|
||||||
|
(import mymod)
|
||||||
|
(assert (= 288 (mymod/myfn 12)) "using sample-bundle")
|
||||||
|
|
||||||
# Manual uninstall of dep1 and dep2 shouldn't work either since that would break dependencies
|
# Manual uninstall of dep1 and dep2 shouldn't work either since that would break dependencies
|
||||||
(assert-error "cannot uninstall sample-dep1, breaks dependent bundles @[\"sample-bundle\"]"
|
(assert-error "cannot uninstall sample-dep1, breaks dependent bundles @[\"sample-bundle\"]"
|
||||||
(bundle/uninstall "sample-dep1"))
|
(bundle/uninstall "sample-dep1"))
|
||||||
|
Loading…
Reference in New Issue
Block a user