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:
Brad Erickson
2019-08-10 18:23:35 -07:00
committed by Ron Evans
parent fd3309afa8
commit 61f711ef26
3 changed files with 167 additions and 25 deletions
+7
View File
@@ -1,3 +1,9 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// This file has been modified for use by the TinyGo compiler.
package testing
// B is a type passed to Benchmark functions to manage benchmark timing and to
@@ -6,5 +12,6 @@ package testing
// TODO: Implement benchmarks. This struct allows test files containing
// benchmarks to compile and run, but will not run the benchmarks themselves.
type B struct {
common
N int
}