diff --git a/.gitignore b/.gitignore index ea35802..3cac2e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -DSLScript*.json \ No newline at end of file +AsyncDSLScript*.json \ No newline at end of file diff --git a/src/test/cases/AsyncDSLScript.dsl b/src/test/cases/AsyncDSLScript.dsl new file mode 100644 index 0000000..cf69cfe --- /dev/null +++ b/src/test/cases/AsyncDSLScript.dsl @@ -0,0 +1,3 @@ +{goop (cc)} +{gloop (cc)} +{(set wholeScriptDone true) (cc)} \ No newline at end of file diff --git a/src/test/cases/AsyncDSLScriptThatWillCache.dsl b/src/test/cases/AsyncDSLScriptThatWillCache.dsl new file mode 100644 index 0000000..cf69cfe --- /dev/null +++ b/src/test/cases/AsyncDSLScriptThatWillCache.dsl @@ -0,0 +1,3 @@ +{goop (cc)} +{gloop (cc)} +{(set wholeScriptDone true) (cc)} \ No newline at end of file diff --git a/src/test/cases/DSL.kiss b/src/test/cases/DSL.kiss index 6d3c2ed..d6fdc34 100644 --- a/src/test/cases/DSL.kiss +++ b/src/test/cases/DSL.kiss @@ -1,4 +1,5 @@ // TODO make a better position reification scheme here (defReaderMacro "goop" [stream] `(Assert.isTrue true)) (defReaderMacro "gloop" [stream] `(Assert.isFalse false)) +(prop &mut wholeScriptDone false) (prop Assert utest.Assert) \ No newline at end of file diff --git a/src/test/cases/DSLScript.dsl b/src/test/cases/DSLScript.dsl index e2ef2c9..8c9b7a5 100644 --- a/src/test/cases/DSLScript.dsl +++ b/src/test/cases/DSLScript.dsl @@ -1,2 +1,3 @@ goop -gloop \ No newline at end of file +gloop +(set wholeScriptDone true) \ No newline at end of file diff --git a/src/test/cases/DSLScriptThatWillCache.dsl b/src/test/cases/DSLScriptThatWillCache.dsl deleted file mode 100644 index e2ef2c9..0000000 --- a/src/test/cases/DSLScriptThatWillCache.dsl +++ /dev/null @@ -1,2 +0,0 @@ -goop -gloop \ No newline at end of file diff --git a/src/test/cases/DSLTestCase.hx b/src/test/cases/DSLTestCase.hx index b30c8e4..d398e82 100644 --- a/src/test/cases/DSLTestCase.hx +++ b/src/test/cases/DSLTestCase.hx @@ -8,7 +8,9 @@ import kiss.Prelude; class DSLTestCase extends Test { function testScript() { - new DSLScript().run(); + var script = new DSLScript(); + script.run(); + Assert.isTrue(script.wholeScriptDone); } function testFork() { @@ -19,24 +21,29 @@ class DSLTestCase extends Test { var script = new AsyncDSLScript(); script.run(); Assert.isFalse(script.ranHscriptInstruction); + Assert.isTrue(script.wholeScriptDone); } function testAsyncFromCache() { var script = new AsyncDSLScriptThatWillCache(); script.run(); var script2 = new AsyncDSLScriptThatWillCache2(); + script2.run(); Assert.isTrue(script.ranHscriptInstruction || script2.ranHscriptInstruction); + Assert.isFalse(script.ranHscriptInstruction && script2.ranHscriptInstruction); + Assert.isTrue(script.wholeScriptDone); + Assert.isTrue(script2.wholeScriptDone); } } @:build(kiss.EmbeddedScript.build("DSL.kiss", "DSLScript.dsl")) class DSLScript extends EmbeddedScript {} -@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "DSLScript.dsl")) +@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "AsyncDSLScript.dsl")) class AsyncDSLScript extends AsyncEmbeddedScript {} -@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "DSLScriptThatWillCache.dsl")) +@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "AsyncDSLScriptThatWillCache.dsl")) class AsyncDSLScriptThatWillCache extends AsyncEmbeddedScript {} -@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "DSLScriptThatWillCache.dsl")) +@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "AsyncDSLScriptThatWillCache.dsl")) class AsyncDSLScriptThatWillCache2 extends AsyncEmbeddedScript {} \ No newline at end of file diff --git a/test.sh b/test.sh index 77f18d5..275ceff 100755 --- a/test.sh +++ b/test.sh @@ -15,8 +15,8 @@ elif [ "$KISS_TARGET" = nodejs ]; then lix install haxelib:hxnodejs fi -if [ -e DSLScript.cache.json ]; then - rm DSLScript*.json +if [ -e AsyncDSLScript.cache.json ]; then + rm AsyncDSLScript*.json fi if [ ! -z "$2" ]; then