Documentation ¶
Index ¶
- Variables
- func CaptureStdout(f func(w io.Writer)) string
- func GetStringMaxWidth(s string) int
- func MapRangeToRange(fromMin, fromMax, toMin, toMax, current float32) int
- func Percentage(total, current float64) float64
- func PercentageRound(total, current float64) float64
- func RemoveAndCountPrefix(input, subString string) (string, int)
- func TestDoesNotOutput(t *testing.T, logic func(w io.Writer))
- func TestDoesOutput(t *testing.T, logic func(w io.Writer))
- func TestEmpty(t *testing.T, logic func(a interface{}) string)
- func TestPrintContains(t *testing.T, logic func(w io.Writer, a interface{}))
- func TestPrintfContains(t *testing.T, logic func(w io.Writer, format string, a interface{}))
- func TestPrintlnContains(t *testing.T, logic func(w io.Writer, a interface{}))
- func TestSprintContains(t *testing.T, logic func(a interface{}) string)
- func TestSprintContainsWithoutError(t *testing.T, logic func(a interface{}) (string, error))
- func TestSprintfContains(t *testing.T, logic func(format string, a interface{}) string)
- func TestSprintlnContains(t *testing.T, logic func(a interface{}) string)
- func WithBoolean(b []bool) bool
Constants ¶
This section is empty.
Variables ¶
var RandomStrings = []string{
"hello world", "²³14234!`§=)$-.€@_&", "This is a sentence.", "This\nstring\nhas\nmultiple\nlines",
"windows\r\nline\r\nendings", "\rtext",
}
RandomStrings contains a list of random strings to use while testing.
Functions ¶
func CaptureStdout ¶
CaptureStdout captures everything written to the terminal and returns it as a string.
func GetStringMaxWidth ¶
GetStringMaxWidth returns the maximum width of a string with multiple lines.
func MapRangeToRange ¶
func PercentageRound ¶
PercentageRound returns a rounded Percentage.
func RemoveAndCountPrefix ¶
func TestDoesNotOutput ¶
TestDoesNotOutput can be used, to test that something does not output anything to stdout.
func TestDoesOutput ¶
TestDoesOutput can be used to test if something is outputted to stdout.
func TestPrintContains ¶
TestPrintContains can be used to test Print methods.
func TestPrintfContains ¶
TestPrintfContains can be used to test Printf methods.
func TestPrintlnContains ¶
TestPrintlnContains can be used to test Println methods.
func TestSprintContains ¶
TestSprintContains can be used to test Sprint methods.
func TestSprintContainsWithoutError ¶
TestSprintContainsWithoutError can be used to test Sprint methods which return an error.
func TestSprintfContains ¶
TestSprintfContains can be used to test Sprintf methods.
func TestSprintlnContains ¶
TestSprintlnContains can be used to test Sprintln methods.
func WithBoolean ¶
WithBoolean helps an option setter (WithXXX(b ...bool) to return true, if no boolean is set, but false if it's explicitly set to false.
Types ¶
This section is empty.