mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 07:53:40 +00:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user