diff options
| author | 2024-05-26 09:27:22 -0500 | |
|---|---|---|
| committer | 2024-05-26 09:28:56 -0500 | |
| commit | 6cd35ed9c81168bfbfc85011289bf03fa3226aa2 (patch) | |
| tree | 3f7e2f03e66d375f60256f4307b912ba13e3807a /test | |
| parent | Use lstat instead of stat (diff) | |
Try and be OS sensitive when using path separators.
Diffstat (limited to 'test')
| -rw-r--r-- | test/suite-bundle.janet | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/suite-bundle.janet b/test/suite-bundle.janet index 4522131f..a92a318d 100644 --- a/test/suite-bundle.janet +++ b/test/suite-bundle.janet @@ -27,26 +27,27 @@ (defn- bundle-rpath [path] (string/replace-all "\\" "/" (os/realpath path))) -(def- sep (if (= :windows (os/which)) "\\" "/")) + (defn- rmrf "rm -rf in janet" [x] - (case (os/stat x :mode) - :file (os/rm x) + (case (os/lstat x :mode) + nil nil :directory (do - (each y (os/dir x) (rmrf (string x sep y))) - (os/rmdir x))) + (each y (os/dir x) + (rmrf (string x "/" y))) + (os/rmdir x)) + (os/rm x)) nil) + # Setup a temporary syspath for manipultation (math/seedrandom (os/cryptorand 16)) -(def syspath (string "." sep (string (math/random)) "_jpm_tree.tmp")) +(def syspath (string (math/random) "_jpm_tree.tmp")) (rmrf syspath) (assert (os/mkdir syspath)) (put root-env *syspath* (bundle-rpath syspath)) #(setdyn *out* @"") -(pp (bundle/list)) -(pp (bundle/topolist)) (assert (empty? (bundle/list)) "initial bundle/list") (assert (empty? (bundle/topolist)) "initial bundle/topolist") @@ -61,7 +62,6 @@ (assert-no-error "sample-dep2 reinstall" (bundle/reinstall "sample-dep2")) (assert-no-error "sample-dep1 reinstall" (bundle/reinstall "sample-dep1" :auto-remove true)) -(eprintf "%.99M" (bundle/list)) (assert (= 2 (length (bundle/list))) "bundles are listed correctly 1") (assert (= 2 (length (bundle/topolist))) "bundles are listed correctly 2") |
