Documentation ¶
Index ¶
- func NewNullable(testFiles *map[string]string) (IC, *NullTester, *atomic.Bool, *cmd.OverridableFlagChecker)
- func PrintTable(w io.Writer, table any) error
- type DebugStringer
- type IC
- func (ic *IC) ClearReplace()
- func (ic *IC) Expect(want string)
- func (ic *IC) ExpectAndContinue(want string)
- func (ic *IC) PS()
- func (ic *IC) PT(val any)
- func (ic *IC) PV(val any)
- func (ic *IC) PVWN(name string, val any)
- func (ic *IC) Print(output ...any)
- func (ic *IC) PrintSection(name string)
- func (ic *IC) PrintSep()
- func (ic *IC) PrintTable(val any)
- func (ic *IC) PrintValWithName(name string, val any)
- func (ic *IC) PrintVals(val any)
- func (ic *IC) Printf(format string, a ...any)
- func (ic *IC) PrintfSection(format string, a ...any)
- func (ic *IC) Println(output ...any)
- func (ic *IC) Replace(regex string, repl string)
- type NullTester
- type TT
- type TestFileUpdater
- type Tester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNullable ¶
func NewNullable(testFiles *map[string]string) (IC, *NullTester, *atomic.Bool, *cmd.OverridableFlagChecker)
Types ¶
type DebugStringer ¶
type DebugStringer interface {
DebugString() string
}
DebugStringer allows for exactly defining the debug string used in tests.
func DebugWrap ¶
func DebugWrap(val any) DebugStringer
func DebugWrapNil ¶
func DebugWrapNil(val any) DebugStringer
func DebugWrapString ¶
func DebugWrapString(val string) DebugStringer
type IC ¶
IC is the test value runner. Create with New(*testing.TB)
func (*IC) ClearReplace ¶
func (ic *IC) ClearReplace()
ClearReplace can be used to reset the active replacements
func (*IC) Expect ¶
Expect will compare the provided string to all the calls to ic.Print* combined. If "want" is an empty string, the library will automatically replace it with the provided value if either is set:
- "IC_UPDATE" environment variable
- "-test.icupdate" command line flag is set
Expect will fail the test immediately on failure. ExpectAndContinue can be used to keep running the rest of the test
func (*IC) ExpectAndContinue ¶
ExpectAndContinue behaves exactly like Expect, with the exception that the test will continue to run on a failure
func (*IC) PrintSection ¶
func (*IC) PrintTable ¶
PrintTable will take an array of structs and print a table
func (*IC) PrintValWithName ¶
PrintValWithName is a simple formatter for testing values
func (*IC) PrintVals ¶
PrintVals will take any struct and call PrintValWithName on each of the exported fields
func (*IC) PrintfSection ¶
type NullTester ¶
NullTester is useful to fake out testing.T in order to verify we handle failures correctly
func NewNullTester ¶
func NewNullTester() *NullTester
func (*NullTester) Fail ¶
func (nt *NullTester) Fail()
func (*NullTester) FailNow ¶
func (nt *NullTester) FailNow()
func (*NullTester) Helper ¶
func (nt *NullTester) Helper()
func (*NullTester) Log ¶
func (nt *NullTester) Log(args ...any)
func (*NullTester) Logf ¶
func (nt *NullTester) Logf(format string, args ...any)
func (*NullTester) Reset ¶
func (nt *NullTester) Reset()
type TestFileUpdater ¶
type TestFileUpdater struct {
// contains filtered or unexported fields
}
func NewNullableTestFileUpdater ¶
func NewNullableTestFileUpdater(testFiles *map[string]string) (TestFileUpdater, *atomic.Bool, *cmd.OverridableFlagChecker)
func NewTestFileUpdater ¶
func NewTestFileUpdater() TestFileUpdater
func (TestFileUpdater) Update ¶
func (d TestFileUpdater) Update(ic *IC, got string)
func (TestFileUpdater) UpdateEnabled ¶
func (d TestFileUpdater) UpdateEnabled() bool