mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
61f711ef26
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.
26 lines
446 B
Go
26 lines
446 B
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) {
|
|
}
|