aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorBrad Erickson <[email protected]>2019-08-10 18:23:35 -0700
committerRon Evans <[email protected]>2019-08-13 20:59:09 +0200
commit61f711ef26e48b0e3a1539c849f4a26aa8dd08f3 (patch)
tree1a4a1b60e1208e6d929860ce5c37128ea34d0d57 /tests
parentfd3309afa8452fecffb81cbede3609d35dccaea8 (diff)
downloadtinygo-61f711ef26e48b0e3a1539c849f4a26aa8dd08f3.tar.gz
tinygo-61f711ef26e48b0e3a1539c849f4a26aa8dd08f3.zip
Add common test logging methods such as Errorf/Fatalf/Printf
Implements nearly all of the test logging methods for both T and B structs. Majority of the code has been copied from: golang.org/src/testing/testing.go then updated to match the existing testing.go structure. Code structure/function/method order mimics upstream. Both FailNow() and SkipNow() cannot be completely implemented, because they require an early exit from the goroutine. Instead, they call Error() to report the limitation. This incomplete implementation allows more detailed test logging and increases compatiblity with upstream.
Diffstat (limited to 'tests')
-rw-r--r--tests/tinygotest/main_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/tinygotest/main_test.go b/tests/tinygotest/main_test.go
index 263aac149..e8594ac1f 100644
--- a/tests/tinygotest/main_test.go
+++ b/tests/tinygotest/main_test.go
@@ -9,10 +9,16 @@ func TestFail1(t *testing.T) {
}
func TestFail2(t *testing.T) {
- t.Error("TestFail2 failed for reasons")
+ t.Fatalf("TestFail2 failed for %v ", "reasons")
+}
+
+func TestFail3(t *testing.T) {
+ t.Fail()
+ t.Logf("TestFail3 failed for %v ", "reasons")
}
func TestPass(t *testing.T) {
+ t.Log("TestPass passed")
}
func BenchmarkNotImplemented(b *testing.B) {