initial harness code and read channel
[scpubgit/TenDotTcl.git] / ten / test.tcl
diff --git a/ten/test.tcl b/ten/test.tcl
new file mode 100644 (file)
index 0000000..c577494
--- /dev/null
@@ -0,0 +1,31 @@
+namespace eval ::ten::test:: {
+
+  variable test_count 0
+
+  proc pass {reason} {
+    variable test_count
+    incr test_count
+    puts stdout "ok $test_count $reason"
+  }
+
+  proc fail {reason} {
+    variable test_count
+    incr test_count
+    puts stdout "not ok $test_count $reason"
+  }
+
+  proc is {left right reason} {
+    switch $left \
+      $right { pass $reason } \
+      default { fail "$reason: expected $left, got $right" }
+  }
+
+  proc done_testing {} {
+    variable test_count
+    puts stdout "1..$test_count"
+  }
+
+  namespace export pass fail is done_testing
+}
+
+package provide ten::test 0.0.1