internal

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 added in v0.7.0

func CaptureStdout(f func(w io.Writer)) string

CaptureStdout captures everything written to the terminal and returns it as a string.

func GetMaxStringMaxWidth added in v0.8.0

func GetMaxStringMaxWidth(s string) int

GetMaxStringMaxWidth returns the maximum width of a string with multiple lines.

func MapRangeToRange added in v0.5.1

func MapRangeToRange(fromMin, fromMax, toMin, toMax, current float32) int

func Percentage

func Percentage(total, current float64) float64

Percentage calculates percentage.

func PercentageRound

func PercentageRound(total, current float64) float64

PercentageRound returns a rounded Percentage.

func RemoveAndCountPrefix added in v0.8.0

func RemoveAndCountPrefix(input, subString string) (string, int)

func TestDoesOutput added in v0.8.0

func TestDoesOutput(t *testing.T, logic func(w io.Writer))

TestDoesOutput can be used to test if something is outputted to stdout.

func TestPrintContains added in v0.7.0

func TestPrintContains(t *testing.T, logic func(w io.Writer, a interface{}))

TestPrintContains can be used to test Print methods.

func TestPrintfContains added in v0.7.0

func TestPrintfContains(t *testing.T, logic func(w io.Writer, format string, a interface{}))

TestPrintfContains can be used to test Printf methods.

func TestPrintlnContains added in v0.7.0

func TestPrintlnContains(t *testing.T, logic func(w io.Writer, a interface{}))

TestPrintlnContains can be used to test Println methods.

func TestSprintContains added in v0.7.0

func TestSprintContains(t *testing.T, logic func(a interface{}) string)

TestSprintContains can be used to test Sprint methods.

func TestSprintfContains added in v0.7.0

func TestSprintfContains(t *testing.T, logic func(format string, a interface{}) string)

TestSprintfContains can be used to test Sprintf methods.

func TestSprintlnContains added in v0.7.0

func TestSprintlnContains(t *testing.T, logic func(a interface{}) string)

TestSprintlnContains can be used to test Sprintln methods.

func WithBoolean added in v0.3.0

func WithBoolean(b []bool) bool

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.

Jump to

Keyboard shortcuts

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