Refactoring the testing system Close #58 Close #40

This commit is contained in:
2019-05-15 10:26:05 -06:00
parent 1f6d16b390
commit d6e8d39762
20 changed files with 71 additions and 44 deletions

View File

@@ -1,9 +0,0 @@
package tests;
import utest.Test;
class AllTestsMain extends Test {
public static function main() {
InternalsTestMain.main();
ExamplesTestMain.main();
}
}

View File

@@ -19,6 +19,7 @@ class TestObject {
}
@:build(hank.FileLoadingMacro.build(["examples/diverts/"]))
class HInterfaceTest extends utest.Test {
var hInterface: HInterface;
@@ -26,7 +27,7 @@ class HInterfaceTest extends utest.Test {
var root: Array<StoryNode>;
public function setup() {
storyTree = StoryNode.FromAST(new Parser().parseFile("examples/diverts/main.hank"));
storyTree = StoryNode.FromAST(new Parser().parseFile("examples/diverts/main.hank", files));
var viewCounts = storyTree.createViewCounts();
root = [storyTree];

View File

@@ -7,6 +7,7 @@ import hank.HankBuffer;
import hank.HankBuffer.Position;
import hank.HankAssert;
@:build(hank.FileLoadingMacro.build(["examples/parsing/"]))
class HankBufferTest extends utest.Test {
var file: HankBuffer;
var path: String;
@@ -14,7 +15,7 @@ class HankBufferTest extends utest.Test {
function setup() {
path = 'examples/parsing/file.txt';
file = HankBuffer.FromFile(path);
file = HankBuffer.FromFile(path, files);
expectedPosition = new Position(path, 1, 1);
}
@@ -103,7 +104,7 @@ class HankBufferTest extends utest.Test {
}
function testGetLineTrimming() {
file = HankBuffer.FromFile('examples/parsing/whitespace.txt');
file = HankBuffer.FromFile('examples/parsing/whitespace.txt', files);
HankAssert.equals(Some("Just give me this output."), file.peekLine("lr"));
HankAssert.equals(Some(" Just give me this output."), file.peekLine("r"));
@@ -116,14 +117,14 @@ class HankBufferTest extends utest.Test {
}
function testSkipWhitespace() {
file = HankBuffer.FromFile('examples/parsing/whitespace.txt');
file = HankBuffer.FromFile('examples/parsing/whitespace.txt', files);
file.skipWhitespace();
HankAssert.equals("Just", file.take(4));
}
function testFindNestedExpression() {
file = HankBuffer.FromFile('examples/parsing/nesting.txt');
file = HankBuffer.FromFile('examples/parsing/nesting.txt', files);
var slice1 = file.findNestedExpression('{', '}', 0);
HankAssert.contains("doesn't contain what comes first", slice1.unwrap().checkValue());
HankAssert.contains("Ends before here", slice1.unwrap().checkValue());

View File

@@ -1,9 +1,9 @@
package tests;
package tests.main;
import utest.Test;
import hank.StoryTestCase;
@:build(hank.FileLoadingMacro.build(["examples/"]))
class ExamplesTestMain extends Test {
class Examples extends Test {
public static function main() {
utest.UTest.run([new StoryTestCase("examples"
#if !sys

View File

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