ansi

package
v2.0.0-...-4b7107c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 5 Imported by: 0

README

Ansi Tester

Description

This project provides a simple wrapper for the go test testing.T facility to offer stats tracking and color coded output.

Usage

//initialize the tester...
test:=ansi.Test(t)
//defer stats printout when all else is done.
defer ansi.Test(t).Stats()
//report a passing test
ansi.Test(t).Pass("this works")
//Report a failed test
ansi.test(t).Fail("this was broken")
//Report a skip
ansi.test(t).Skip("this was skipped")

The tool will provide output similar to this proof of concept:

--- PASS: TestCalcMaxColumnWidth (0.00s)
=== RUN TestLeftPad
[ OK ] Incrementing padding-size test
[ OK ] same-length test
[ OK ] zero-length test
[ OK ] negative-length test
---Test Statistics---
Pass: 4
Fail: 0
Skip: 0
---------------------
--- PASS: TestLeftPad (0.00s)
=== RUN TestNullObjectStructSize
--- PASS: TestNullObjectStructSize (0.00s)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T struct {
	// contains filtered or unexported fields
}

T - The state of the Ansi Tester

func Test

func Test(t *testing.T) *T

Test - create a new ansi Tester (T) object

func (*T) Fail

func (test *T) Fail(msg string) *T

Fail - A Fatal error in a test

func (*T) Failf

func (test *T) Failf(format string, msg ...any) *T

Failf - A Fatal error in a test

func (*T) Fatal

func (test *T) Fatal(msg ...any)

Fatal - A Fatal error in a test

func (*T) Fatalf

func (test *T) Fatalf(format string, msg ...any)

Fatalf - A Fatal error in a test

func (*T) Pass

func (test *T) Pass(msg string) *T

Pass - A passing test report

func (*T) Passf

func (test *T) Passf(format string, msg ...any) *T

Passf - A passing test report

func (*T) Skip

func (test *T) Skip(msg string) *T

Skip - A skipped test report

func (*T) Skipf

func (test *T) Skipf(format string, msg ...any) *T

Skipf - A skipped test report

func (*T) Stats

func (test *T) Stats()

Stats - Print the stats report

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL