Refactor travis testing
This commit is contained in:
11
projects/nat-archive-tool/src/test/TestMain.hx
Normal file
11
projects/nat-archive-tool/src/test/TestMain.hx
Normal file
@@ -0,0 +1,11 @@
|
||||
package test;
|
||||
|
||||
import kiss.Kiss;
|
||||
import kiss.Prelude;
|
||||
import nat.BoolExpInterp;
|
||||
import nat.Archive;
|
||||
import nat.Lib;
|
||||
import nat.components.*;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class TestMain {}
|
28
projects/nat-archive-tool/src/test/TestMain.kiss
Normal file
28
projects/nat-archive-tool/src/test/TestMain.kiss
Normal 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)"))
|
||||
))
|
@@ -0,0 +1 @@
|
||||
"Rafael Krux"
|
@@ -0,0 +1 @@
|
||||
"Kevin MacLeod"
|
@@ -0,0 +1 @@
|
||||
"Adventure"
|
@@ -0,0 +1 @@
|
||||
"Ancient Rite"
|
@@ -0,0 +1,4 @@
|
||||
[
|
||||
["song", 1],
|
||||
["western", 1]
|
||||
]
|
@@ -0,0 +1,4 @@
|
||||
[
|
||||
["song", 1],
|
||||
["religious", 1]
|
||||
]
|
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "song1",
|
||||
"components": [
|
||||
["Name", "name1"],
|
||||
["Author", "author1"],
|
||||
["Tags", "tags1"]
|
||||
],
|
||||
"files": [
|
||||
"Adventure.mp3"
|
||||
]
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "song2",
|
||||
"components": [
|
||||
["Name", "name2"],
|
||||
["Author", "author2"],
|
||||
["Tags", "tags2"]
|
||||
],
|
||||
"files": [
|
||||
"Ancient Rite.mp3"
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user