aboutsummaryrefslogtreecommitdiffstats
path: root/test_runner.go
diff options
context:
space:
mode:
authorobscuren <obscuren@obscura.com>2014-01-01 22:49:38 +0800
committerobscuren <obscuren@obscura.com>2014-01-01 22:49:38 +0800
commit5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa (patch)
treeafddcdcfbc1eac391b2619af9fcb1663032edaaf /test_runner.go
parent61d67f2ae965a9a1113084f2352e2c2dd97ab9a7 (diff)
downloaddexon-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.gz
dexon-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.zst
dexon-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.zip
Work in progress external test runner
Diffstat (limited to 'test_runner.go')
-rw-r--r--test_runner.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/test_runner.go b/test_runner.go
new file mode 100644
index 000000000..da93533dd
--- /dev/null
+++ b/test_runner.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+ "fmt"
+ "testing"
+ "encoding/json"
+)
+
+type TestSource struct {
+ Inputs map[string]string
+ Expectation string
+}
+
+func NewTestSource(source string) *TestSource {
+ s := &TestSource{}
+ err := json.Unmarshal([]byte(source), s)
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ return s
+}
+
+type TestRunner struct {
+ source *TestSource
+}
+
+func NewTestRunner(t *testing.T) *TestRunner {
+ return &TestRunner{}
+}
+
+func (runner *TestRunner) RunFromString(input string, Cb func(*TestSource)) {
+ source := NewTestSource(input)
+ Cb(source)
+}