Refactor transcript running into Hank library

This commit is contained in:
2019-04-30 15:57:22 -06:00
parent d7f3e302b4
commit 35d259ce0c
3 changed files with 44 additions and 38 deletions

View File

@@ -1,36 +0,0 @@
package tests;
import haxe.CallStack;
using StringTools;
import utest.Assert;
class StoryTest extends hank.StoryTestCase {
function testAllExamples() {
var exampleFolders = sys.FileSystem.readDirectory('examples');
// Iterate through every example in the examples folder
for (folder in exampleFolders) {
trace('Running tests for example "${folder}"');
var files = sys.FileSystem.readDirectory('examples/${folder}');
for (file in files) {
if (file.endsWith('.hlog')) {
var disabled = file.indexOf("disabled") != -1;
var debug = file.indexOf("debug") != -1;
var partial = file.indexOf("partial") != -1;
if (!disabled) {
trace(' Running ${file}');
try {
validateAgainstTranscript('examples/${folder}/main.hank', 'examples/${folder}/${file}', !partial);
} catch (e: Dynamic) {
trace('Error testing $folder/$file: $e');
trace(CallStack.exceptionStack());
Assert.fail();
}
}
}
}
}
}
}

View File

@@ -1,8 +1,9 @@
package tests;
import utest.Test;
import hank.StoryTestCase;
class TestMain extends Test {
public static function main() {
utest.UTest.run([new HInterfaceTest(), new HankBufferTest(), new ParserTest(), new StoryTest(), new StoryTreeTest()]);
utest.UTest.run([new HInterfaceTest(), new HankBufferTest(), new ParserTest(), new StoryTestCase("examples"), new StoryTreeTest()]);
}
}