aboutsummaryrefslogtreecommitdiff
path: root/examples/SimpleTests.hx
diff options
context:
space:
mode:
authorrc_05 <contact@rc-05.com>2024-05-14 01:07:07 +0200
committerrc_05 <contact@rc-05.com>2024-05-14 01:18:42 +0200
commit875e8b54c907c60682567a6f900cbf99bedf55c5 (patch)
tree44dc606fa92217781cb33393810b778ebd76cf36 /examples/SimpleTests.hx
downloadhaxe-tester-875e8b54c907c60682567a6f900cbf99bedf55c5.tar.gz
First commit.
Diffstat (limited to 'examples/SimpleTests.hx')
-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();
+ }
+}