Refactor travis testing

This commit is contained in:
2021-06-07 12:36:22 -06:00
commit 8fd76d9a49
34 changed files with 288 additions and 0 deletions

28
src/test/TestMain.kiss Normal file
View File

@@ -0,0 +1,28 @@
// TODO external programs need to be able to find and (load) this path to get the macros:
// ^ That should be solved by allowing an optional first argument to load that is a symbol
// of a library name that can be used to resolve the source dir in the user's Haxelib maybe?
(load "../nat/Lib.kiss")
(defun :Void main []
(assert (BoolExpInterp.eval "true" []))
(assert !(BoolExpInterp.eval "false" []))
(assert !(BoolExpInterp.eval "flag" []))
(assert (BoolExpInterp.eval "flag" ["flag"]))
(assert !(BoolExpInterp.eval "(and flag false)" ["flag"]))
(assert (BoolExpInterp.eval "(or flag otherFlag)" ["otherFlag"]))
//trace(error);
(let [archive
(new Archive "src/test/example-archive")
song1
(dictGet archive.entries "song1")
song2
(dictGet archive.entries "song2")]
(assert (hasComponent song1 Tags))
(assert (hasComponent song2 Tags))
(assert (tagsMatch archive song1 "(and song western)"))
(assert !(tagsMatch archive song1 "(and song religious)"))
(assert (tagsMatch archive song2 "(and song religious)"))
(assert !(tagsMatch archive song2 "(and song western)"))
))