DSLTestCase catch cached script not proceeding error

This commit is contained in:
2023-07-17 11:36:51 -06:00
parent 963ef06196
commit 552d3978e4
8 changed files with 23 additions and 10 deletions

2
.gitignore vendored
View File

@@ -1 +1 @@
DSLScript*.json AsyncDSLScript*.json

View File

@@ -0,0 +1,3 @@
{goop (cc)}
{gloop (cc)}
{(set wholeScriptDone true) (cc)}

View File

@@ -0,0 +1,3 @@
{goop (cc)}
{gloop (cc)}
{(set wholeScriptDone true) (cc)}

View File

@@ -1,4 +1,5 @@
// TODO make a better position reification scheme here // TODO make a better position reification scheme here
(defReaderMacro "goop" [stream] `(Assert.isTrue true)) (defReaderMacro "goop" [stream] `(Assert.isTrue true))
(defReaderMacro "gloop" [stream] `(Assert.isFalse false)) (defReaderMacro "gloop" [stream] `(Assert.isFalse false))
(prop &mut wholeScriptDone false)
(prop Assert utest.Assert) (prop Assert utest.Assert)

View File

@@ -1,2 +1,3 @@
goop goop
gloop gloop
(set wholeScriptDone true)

View File

@@ -1,2 +0,0 @@
goop
gloop

View File

@@ -8,7 +8,9 @@ import kiss.Prelude;
class DSLTestCase extends Test { class DSLTestCase extends Test {
function testScript() { function testScript() {
new DSLScript().run(); var script = new DSLScript();
script.run();
Assert.isTrue(script.wholeScriptDone);
} }
function testFork() { function testFork() {
@@ -19,24 +21,29 @@ class DSLTestCase extends Test {
var script = new AsyncDSLScript(); var script = new AsyncDSLScript();
script.run(); script.run();
Assert.isFalse(script.ranHscriptInstruction); Assert.isFalse(script.ranHscriptInstruction);
Assert.isTrue(script.wholeScriptDone);
} }
function testAsyncFromCache() { function testAsyncFromCache() {
var script = new AsyncDSLScriptThatWillCache(); var script = new AsyncDSLScriptThatWillCache();
script.run(); script.run();
var script2 = new AsyncDSLScriptThatWillCache2(); var script2 = new AsyncDSLScriptThatWillCache2();
script2.run();
Assert.isTrue(script.ranHscriptInstruction || script2.ranHscriptInstruction); 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")) @:build(kiss.EmbeddedScript.build("DSL.kiss", "DSLScript.dsl"))
class DSLScript extends EmbeddedScript {} class DSLScript extends EmbeddedScript {}
@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "DSLScript.dsl")) @:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "AsyncDSLScript.dsl"))
class AsyncDSLScript extends AsyncEmbeddedScript {} class AsyncDSLScript extends AsyncEmbeddedScript {}
@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "DSLScriptThatWillCache.dsl")) @:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "AsyncDSLScriptThatWillCache.dsl"))
class AsyncDSLScriptThatWillCache extends AsyncEmbeddedScript {} class AsyncDSLScriptThatWillCache extends AsyncEmbeddedScript {}
@:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "DSLScriptThatWillCache.dsl")) @:build(kiss.AsyncEmbeddedScript.build("", "DSL.kiss", "AsyncDSLScriptThatWillCache.dsl"))
class AsyncDSLScriptThatWillCache2 extends AsyncEmbeddedScript {} class AsyncDSLScriptThatWillCache2 extends AsyncEmbeddedScript {}

View File

@@ -15,8 +15,8 @@ elif [ "$KISS_TARGET" = nodejs ]; then
lix install haxelib:hxnodejs lix install haxelib:hxnodejs
fi fi
if [ -e DSLScript.cache.json ]; then if [ -e AsyncDSLScript.cache.json ]; then
rm DSLScript*.json rm AsyncDSLScript*.json
fi fi
if [ ! -z "$2" ]; then if [ ! -z "$2" ]; then