-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:janet-lang/spork
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is a test file for suite 17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(use ../spork/test) | ||
(import ../spork/sh) | ||
(import ../spork/path) | ||
|
||
(start-suite 17) | ||
|
||
(def base-path "test") | ||
|
||
(do | ||
(assert (deep= (os/dir (path/join base-path "assets/17")) | ||
@["test.file"]) | ||
"test files are wrong, assets/17 should only contain test.file") | ||
(sh/copy-file (path/join base-path "assets/17/test.file") | ||
(path/join base-path "assets/17/test2.file")) | ||
(def new_file (slurp (path/join base-path "assets/17/test2.file"))) | ||
(assert (deep= (sort (sh/list-all-files (path/join base-path "assets"))) | ||
(map |(path/join base-path $0) | ||
@["assets/17/test.file" "assets/17/test2.file"])) | ||
"sh/list-all-files didn't list the correct files") | ||
(sh/rm (path/join base-path "assets/17/test2.file")) | ||
(assert (deep= (os/dir (path/join base-path "assets/17")) | ||
@["test.file"]) | ||
"file test2.file was not removed by sh/rm") | ||
(assert (deep= (slurp (path/join base-path "assets/17/test.file")) | ||
new_file) | ||
"file copied with sh/copy-file is not the same")) | ||
|
||
(do | ||
(sh/create-dirs (path/join base-path "assets/17/some/more/directories/to/test")) | ||
(assert (= ((os/stat (path/join base-path "assets/17/some/more/directories/to/test")) :mode) | ||
:directory) | ||
"sh/create-dirs failed") | ||
(sh/rm (path/join base-path "assets/17/some")) | ||
(assert (= (os/stat (path/join base-path "assets/17/some/more/directories/to/test")) | ||
nil) | ||
"sh/rm didn't work correctly")) | ||
|
||
(end-suite) |