diff --git a/examples/incr/convey.output b/examples/incr/convey.output index 5b6e03f..df7b1ea 100644 --- a/examples/incr/convey.output +++ b/examples/incr/convey.output @@ -1,8 +1,24 @@ -. +=== RUN TestOnce + + Given some integer with a starting value + When the integer is incremented + The value should be greater by one ✔ + + 1 total assertion -.. +--- PASS: TestOnce (0.00s) +=== RUN TestTwice + + Given some integer with a starting value + When the integer is incremented + The value should be greater by one ✔ + When the integer is incremented again + The value should be greater by one ✔ + + 3 total assertions +--- PASS: TestTwice (0.00s) PASS -ok github.com/jordanorelli/tea/examples/incr 0.002s +ok github.com/jordanorelli/tea/examples/incr 0.003s diff --git a/examples/incr/run-all b/examples/incr/run-all index baa4c18..cc633f9 100755 --- a/examples/incr/run-all +++ b/examples/incr/run-all @@ -1,5 +1,5 @@ #!/usr/bin/env bash -go test 2>&1 | tee tea.output -go test -tags std 2>&1 | tee std.output -go test -tags convey 2>&1 | tee convey.output +go test 2>&1 -v | tee tea.output +go test -tags std -v 2>&1 | tee std.output +go test -tags convey -v 2>&1 | tee convey.output diff --git a/examples/incr/std.output b/examples/incr/std.output index 05a2331..747d310 100644 --- a/examples/incr/std.output +++ b/examples/incr/std.output @@ -1,6 +1,14 @@ +=== RUN TestOnce +=== RUN TestOnce/increment +--- PASS: TestOnce (0.00s) + --- PASS: TestOnce/increment (0.00s) +=== RUN TestTwice +=== RUN TestTwice/increment +=== RUN TestTwice/increment#01 + TestTwice/increment#01: std_test.go:34: expected x to be 2, is 3 instead --- FAIL: TestTwice (0.00s) + --- PASS: TestTwice/increment (0.00s) --- FAIL: TestTwice/increment#01 (0.00s) - std_test.go:34: expected x to be 2, is 3 instead FAIL exit status 1 -FAIL github.com/jordanorelli/tea/examples/incr 0.002s +FAIL github.com/jordanorelli/tea/examples/incr 0.001s diff --git a/examples/incr/tea.output b/examples/incr/tea.output index 302823d..a108ddc 100644 --- a/examples/incr/tea.output +++ b/examples/incr/tea.output @@ -1,17 +1,49 @@ ---- FAIL: TestOnce (0.00s) - --- FAIL: TestOnce/testInt (0.00s) - tea_test.go:15: saving to future tests X = 1 - --- FAIL: TestOnce/testInt/testIncr (0.00s) - tea_test.go:15: saving to future tests X = 1 - tea_test.go:24: loaded from parent tests X = 1 - tea_test.go:29: saving to future tests X = 2 - --- FAIL: TestOnce/testInt/testIncr/testIncr (0.00s) - tea_test.go:15: saving to future tests X = 1 - tea_test.go:24: loaded from parent tests X = 1 - tea_test.go:29: saving to future tests X = 2 - tea_test.go:24: loaded from parent tests X = 1 - tea_test.go:27: expected X to be 3, is 2 instead - tea_test.go:29: saving to future tests X = 2 -FAIL -exit status 1 -FAIL github.com/jordanorelli/tea/examples/incr 0.002s +=== RUN TestOnce +=== RUN TestOnce/testInt + TestOnce/testInt: tea_test.go:20: saving to future tests X = 1 +=== RUN TestOnce/testInt/testIncr + TestOnce/testInt/testIncr: tea_test.go:20: saving to future tests X = 1 + TestOnce/testInt/testIncr: tea_test.go:33: loaded from parent tests X = 1 + TestOnce/testInt/testIncr: tea_test.go:38: saving to future tests X = 2 +--- PASS: TestOnce (0.00s) + --- PASS: TestOnce/testInt (0.00s) + --- PASS: TestOnce/testInt/testIncr (0.00s) +=== RUN TestTwice +=== RUN TestTwice/testInt + TestTwice/testInt: tea_test.go:20: saving to future tests X = 1 +=== RUN TestTwice/testInt/testIncr + TestTwice/testInt/testIncr: tea_test.go:20: saving to future tests X = 1 + TestTwice/testInt/testIncr: tea_test.go:33: loaded from parent tests X = 1 + TestTwice/testInt/testIncr: tea_test.go:38: saving to future tests X = 2 +=== RUN TestTwice/testInt/testIncr#01 + TestTwice/testInt/testIncr#01: tea_test.go:20: saving to future tests X = 1 + TestTwice/testInt/testIncr#01: tea_test.go:33: loaded from parent tests X = 1 + TestTwice/testInt/testIncr#01: tea_test.go:38: saving to future tests X = 2 +--- PASS: TestTwice (0.00s) + --- PASS: TestTwice/testInt (0.00s) + --- PASS: TestTwice/testInt/testIncr (0.00s) + --- PASS: TestTwice/testInt/testIncr#01 (0.00s) +=== RUN TestTwiceSeries +=== RUN TestTwiceSeries/testInt + TestTwiceSeries/testInt: tea_test.go:20: saving to future tests X = 1 +=== RUN TestTwiceSeries/testInt/testIncr + TestTwiceSeries/testInt/testIncr: tea_test.go:20: saving to future tests X = 1 + TestTwiceSeries/testInt/testIncr: tea_test.go:33: loaded from parent tests X = 1 + TestTwiceSeries/testInt/testIncr: tea_test.go:38: saving to future tests X = 2 +=== RUN TestTwiceSeries/testInt/testIncr/testIncr + TestTwiceSeries/testInt/testIncr/testIncr: tea_test.go:20: saving to future tests X = 1 + TestTwiceSeries/testInt/testIncr/testIncr: tea_test.go:33: loaded from parent tests X = 1 + TestTwiceSeries/testInt/testIncr/testIncr: tea_test.go:38: saving to future tests X = 2 + TestTwiceSeries/testInt/testIncr/testIncr: tea_test.go:33: loaded from parent tests X = 2 + TestTwiceSeries/testInt/testIncr/testIncr: tea_test.go:38: saving to future tests X = 3 +=== RUN TestTwiceSeries/testInt/testIncr#01 + TestTwiceSeries/testInt/testIncr#01: tea_test.go:20: saving to future tests X = 1 + TestTwiceSeries/testInt/testIncr#01: tea_test.go:33: loaded from parent tests X = 1 + TestTwiceSeries/testInt/testIncr#01: tea_test.go:38: saving to future tests X = 2 +--- PASS: TestTwiceSeries (0.00s) + --- PASS: TestTwiceSeries/testInt (0.00s) + --- PASS: TestTwiceSeries/testInt/testIncr (0.00s) + --- PASS: TestTwiceSeries/testInt/testIncr/testIncr (0.00s) + --- PASS: TestTwiceSeries/testInt/testIncr#01 (0.00s) +PASS +ok github.com/jordanorelli/tea/examples/incr 0.002s diff --git a/examples/incr/tea_test.go b/examples/incr/tea_test.go index 23c3296..bae97f3 100644 --- a/examples/incr/tea_test.go +++ b/examples/incr/tea_test.go @@ -7,15 +7,20 @@ import ( "testing" ) +// testInt is a Test that does nothing. It always passes. It acts as a +// container for a value to be made available to future tests. type testInt struct { // the "save" struct tag instructs tea to save this field for future tests. X int `tea:"save"` } +// Run satisfies the tea.Test interface so that testInt may be used as a +// tea.Test func (test *testInt) Run(t *testing.T) { t.Logf("saving to future tests X = %d", test.X) } +// testIncr type testIncr struct { // the "load" struct tag instructs tea to load the value of this field from // previous tests in this run. Like before, we also use a "save" tag. @@ -23,6 +28,7 @@ type testIncr struct { expect int } +// Run satisfies the tea.Test interface func (test *testIncr) Run(t *testing.T) { t.Logf("loaded from parent tests X = %d", test.X) test.X++