
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.
25 строки
446 Б
Go
25 строки
446 Б
Go
package main
|
|
|
|
import (
|
|
"testing" // This is the tinygo testing package
|
|
)
|
|
|
|
func TestFail1(t *testing.T) {
|
|
t.Error("TestFail1 failed because of stuff and things")
|
|
}
|
|
|
|
func TestFail2(t *testing.T) {
|
|
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) {
|
|
}
|