Documentation ¶
Index ¶
- func AssertAllObfuscatorsTested(t *testing.T, obfuscators []*obfuscate.Obfuscator)
- func AssertObfuscation(t *testing.T, obfuscators []*obfuscate.Obfuscator, kind obfuscate.Kind, ...)
- func AssertObfuscationExample(t *testing.T, obfuscators []*obfuscate.Obfuscator, kind obfuscate.Kind, ...)
- func CommandExists(cmd string) bool
- func GetHostnameWithoutDomain() string
- func IsPrivilegedUser() bool
- func LoadTestdata(t *testing.T, name string) string
- func StringInSlice(a string, list []string) bool
- type ExtraLogHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertAllObfuscatorsTested ¶
func AssertAllObfuscatorsTested(t *testing.T, obfuscators []*obfuscate.Obfuscator)
func AssertObfuscation ¶
func AssertObfuscation(t *testing.T, obfuscators []*obfuscate.Obfuscator, kind obfuscate.Kind, name, input, expected string)
AssertObfuscation is a helper function for tests where we want to validate if obfuscation.Obfuscator works correctly.
func AssertObfuscationExample ¶
func AssertObfuscationExample(t *testing.T, obfuscators []*obfuscate.Obfuscator, kind obfuscate.Kind, name string)
AssertObfuscationExample uses AssertObfuscation to assert but loads the example automatically from testdata.
Parameter `name` must correspond to the relative file name under testdata, or in case of a command, spaces are replaced by a minus sign, and txt is used for the file extension.
func CommandExists ¶
CommandExists returns true if command exists.
func GetHostnameWithoutDomain ¶
func GetHostnameWithoutDomain() string
GetHostnameWithoutDomain returns hostname without domain.
func IsPrivilegedUser ¶
func IsPrivilegedUser() bool
IsPrivilegedUser returns true when the current user is root.
func LoadTestdata ¶
LoadTestdata loads a file from the testdata directory and returns its contents as string.
Intended to load text file for comparison in assertions.
func StringInSlice ¶
StringInSlice matches if a string is contained in a slice.