aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/SimpleTests.hx40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/SimpleTests.hx b/examples/SimpleTests.hx
new file mode 100644
index 0000000..de065e6
--- /dev/null
+++ b/examples/SimpleTests.hx
@@ -0,0 +1,40 @@
+import tester.Runner;
+import tester.Test.Test;
+import tester.Test.Outcome;
+
+class Foo extends Test {
+ override public function run():Outcome {
+ if (3 < 2) {
+ return Pass;
+ } else {
+ return Fail("Expected 1 < 2");
+ }
+ }
+}
+
+class Bar extends Test {
+ override public function run():Outcome {
+ if (false) {
+ return Pass;
+ } else {
+ return Fail("Test is supposed to always pass.");
+ }
+ }
+}
+
+class SimpleTests {
+ static function main() {
+ var runner = new Runner();
+ var tests = [
+ new Foo("Foo"),
+ new Bar("Bar")
+ ];
+
+ // Prepare the tests to be run.
+ for (test in tests) {
+ runner.addTest(test);
+ }
+ // Run the tests.
+ runner.run();
+ }
+}