Documentation
¶
Overview ¶
Package sztest implements some general go testing helper functions to provide for cleaner more readable tests as well as automatic diffs of unexpected results. In addition to providing general tests it also provides builtin io interfaces that can be used to simulate io errors for code tests. Finally it provides for the capturing of logs and standard output streams with automatic diffs.
Index ¶
- Constants
- Variables
- func CompareArrays[T chkType](got, wnt []T) string
- func CompareSlices[T chkType](title string, got, want []T, minRunSlice, minRunString int, ...) string
- func DiffSlice[T chkType](gotSlice, wntSlice []T, dFmt *diffLnFmt, changed *bool, minRunSlice int, ...) []string
- func DiffString(gotStr, wntStr string, dType diffType, minRun int) string
- func IsFloat32Similar(num1, num2, tolerance float32) bool
- func IsFloat64Similar(num1, num2, tolerance float64) bool
- func ReloadSettings()
- func SettingBufferSize() int
- func SettingDiffChars() int
- func SettingDiffSlice() int
- func SettingFailFast() bool
- func SettingMarkChgOff() string
- func SettingMarkChgOn() string
- func SettingMarkDelOff() string
- func SettingMarkDelOn() string
- func SettingMarkGotOff() string
- func SettingMarkGotOn() string
- func SettingMarkInsOff() string
- func SettingMarkInsOn() string
- func SettingMarkMsgOff() string
- func SettingMarkMsgOn() string
- func SettingMarkSepOff() string
- func SettingMarkSepOn() string
- func SettingMarkWntOff() string
- func SettingMarkWntOn() string
- func SettingPermDir() os.FileMode
- func SettingPermExe() os.FileMode
- func SettingPermFile() os.FileMode
- func SettingTmpDir() string
- type BoundedOption
- type Chk
- func CaptureLog(t testingT) *Chk
- func CaptureLogAndStderr(t testingT) *Chk
- func CaptureLogAndStderrAndStdout(t testingT) *Chk
- func CaptureLogAndStdout(t testingT) *Chk
- func CaptureLogWithStderr(t testingT) *Chk
- func CaptureLogWithStderrAndStdout(t testingT) *Chk
- func CaptureNothing(t testingT) *Chk
- func CaptureStderr(t testingT) *Chk
- func CaptureStderrAndStdout(t testingT) *Chk
- func CaptureStdout(t testingT) *Chk
- func (chk *Chk) AddSub(expr, subStr string)
- func (chk *Chk) Bool(got, want bool, msg ...any) bool
- func (chk *Chk) BoolSlice(got, want []bool, msg ...any) bool
- func (chk *Chk) BoolSlicef(got, want []bool, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Boolf(got, want bool, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Byte(got, want byte, msg ...any) bool
- func (chk *Chk) ByteBounded(got byte, option BoundedOption, minV, maxV byte, msg ...any) bool
- func (chk *Chk) ByteBoundedf(got byte, option BoundedOption, minV, maxV byte, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) ByteSlice(got, want []byte, msg ...any) bool
- func (chk *Chk) ByteSlicef(got, want []byte, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) ByteUnbounded(got byte, option UnboundedOption, bound byte, msg ...any) bool
- func (chk *Chk) ByteUnboundedf(got byte, option UnboundedOption, bound byte, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Bytef(got, want byte, msgFmt string, msgArgs ...any) bool
- func (*Chk) CaptureFlagUsage(flagSet *flag.FlagSet) string
- func (chk *Chk) ClockAddSub(i int)
- func (chk *Chk) ClockLast() time.Time
- func (chk *Chk) ClockLastFmtCusA() string
- func (chk *Chk) ClockLastFmtCusB() string
- func (chk *Chk) ClockLastFmtCusC() string
- func (chk *Chk) ClockLastFmtDate() string
- func (chk *Chk) ClockLastFmtNano() string
- func (chk *Chk) ClockLastFmtTS() string
- func (chk *Chk) ClockLastFmtTime() string
- func (chk *Chk) ClockNext() time.Time
- func (chk *Chk) ClockNextFmtCusA() string
- func (chk *Chk) ClockNextFmtCusB() string
- func (chk *Chk) ClockNextFmtCusC() string
- func (chk *Chk) ClockNextFmtDate() string
- func (chk *Chk) ClockNextFmtNano() string
- func (chk *Chk) ClockNextFmtTS() string
- func (chk *Chk) ClockNextFmtTime() string
- func (chk *Chk) ClockOffset(d time.Duration) func()
- func (chk *Chk) ClockOffsetDay(dayOffset int, inc ...time.Duration) func()
- func (chk *Chk) ClockRemoveSub(i int)
- func (chk *Chk) ClockSet(setTime time.Time, inc ...time.Duration) func()
- func (chk *Chk) ClockSetCusA(f string)
- func (chk *Chk) ClockSetCusB(f string)
- func (chk *Chk) ClockSetCusC(f string)
- func (chk *Chk) ClockSetSub(i int)
- func (chk *Chk) ClockTick(i int) time.Time
- func (chk *Chk) Close() error
- func (chk *Chk) Complex64(got, want complex64, msg ...any) bool
- func (chk *Chk) Complex64Slice(got, want []complex64, msg ...any) bool
- func (chk *Chk) Complex64Slicef(got, want []complex64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Complex64f(got, want complex64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Complex128(got, want complex128, msg ...any) bool
- func (chk *Chk) Complex128Slice(got, want []complex128, msg ...any) bool
- func (chk *Chk) Complex128Slicef(got, want []complex128, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Complex128f(got, want complex128, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) CreateTmpDir() string
- func (chk *Chk) CreateTmpFile(data []byte) string
- func (chk *Chk) CreateTmpFileAs(path, fName string, data []byte) string
- func (chk *Chk) CreateTmpFileIn(path string, data []byte) string
- func (chk *Chk) CreateTmpSubDir(subDirs ...string) string
- func (chk *Chk) CreateTmpUnixScript(lines []string) string
- func (chk *Chk) CreateTmpUnixScriptAs(path, fName string, lines []string) string
- func (chk *Chk) CreateTmpUnixScriptIn(path string, lines []string) string
- func (chk *Chk) DelEnv(name string)
- func (chk *Chk) Dur(got, want time.Duration, msg ...any) bool
- func (chk *Chk) DurBounded(got time.Duration, option BoundedOption, minV, maxV time.Duration, msg ...any) bool
- func (chk *Chk) DurBoundedf(got time.Duration, option BoundedOption, minV, maxV time.Duration, ...) bool
- func (chk *Chk) DurSlice(got, want []time.Duration, msg ...any) bool
- func (chk *Chk) DurSlicef(got, want []time.Duration, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) DurUnbounded(got time.Duration, option UnboundedOption, bound time.Duration, msg ...any) bool
- func (chk *Chk) DurUnboundedf(got time.Duration, option UnboundedOption, bound time.Duration, msgFmt string, ...) bool
- func (chk *Chk) Durf(got, want time.Duration, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Err(got error, want string, msg ...any) bool
- func (chk *Chk) ErrChain(first any, rest ...any) string
- func (chk *Chk) ErrSlice(got []error, want []string, msg ...any) bool
- func (chk *Chk) ErrSlicef(got []error, want []string, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Errf(got error, want string, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Error(args ...any)
- func (chk *Chk) Errorf(msgFmt string, msgArgs ...any)
- func (chk *Chk) FailFast(failFast bool) bool
- func (chk *Chk) False(got bool, msg ...any) bool
- func (chk *Chk) Falsef(got bool, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Fatalf(msgFmt string, msgArgs ...any)
- func (chk *Chk) Float32(got, want, tolerance float32, msg ...any) bool
- func (chk *Chk) Float32Bounded(got float32, option BoundedOption, minV, maxV float32, msg ...any) bool
- func (chk *Chk) Float32Boundedf(got float32, option BoundedOption, minV, maxV float32, msgFmt string, ...) bool
- func (chk *Chk) Float32Slice(got, want []float32, tolerance float32, msg ...any) bool
- func (chk *Chk) Float32Slicef(got, want []float32, tolerance float32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Float32Unbounded(got float32, option UnboundedOption, bound float32, msg ...any) bool
- func (chk *Chk) Float32Unboundedf(got float32, option UnboundedOption, bound float32, msgFmt string, ...) bool
- func (chk *Chk) Float32f(got, want, tolerance float32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Float64(got, want, tolerance float64, msg ...any) bool
- func (chk *Chk) Float64Bounded(got float64, option BoundedOption, minV, maxV float64, msg ...any) bool
- func (chk *Chk) Float64Boundedf(got float64, option BoundedOption, minV, maxV float64, msgFmt string, ...) bool
- func (chk *Chk) Float64Slice(got, want []float64, tolerance float64, msg ...any) bool
- func (chk *Chk) Float64Slicef(got, want []float64, tolerance float64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Float64Unbounded(got float64, option UnboundedOption, bound float64, msg ...any) bool
- func (chk *Chk) Float64Unboundedf(got float64, option UnboundedOption, bound float64, msgFmt string, ...) bool
- func (chk *Chk) Float64f(got, want, tolerance float64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) GetIOWriterData() []byte
- func (chk *Chk) Int(got, want int, msg ...any) bool
- func (chk *Chk) Int8(got, want int8, msg ...any) bool
- func (chk *Chk) Int8Bounded(got int8, option BoundedOption, minV, maxV int8, msg ...any) bool
- func (chk *Chk) Int8Boundedf(got int8, option BoundedOption, minV, maxV int8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int8Slice(got, want []int8, msg ...any) bool
- func (chk *Chk) Int8Slicef(got, want []int8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int8Unbounded(got int8, option UnboundedOption, bound int8, msg ...any) bool
- func (chk *Chk) Int8Unboundedf(got int8, option UnboundedOption, bound int8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int8f(got, want int8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int16(got, want int16, msg ...any) bool
- func (chk *Chk) Int16Bounded(got int16, option BoundedOption, minV, maxV int16, msg ...any) bool
- func (chk *Chk) Int16Boundedf(got int16, option BoundedOption, minV, maxV int16, msgFmt string, ...) bool
- func (chk *Chk) Int16Slice(got, want []int16, msg ...any) bool
- func (chk *Chk) Int16Slicef(got, want []int16, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int16Unbounded(got int16, option UnboundedOption, bound int16, msg ...any) bool
- func (chk *Chk) Int16Unboundedf(got int16, option UnboundedOption, bound int16, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int16f(got, want int16, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int32(got, want int32, msg ...any) bool
- func (chk *Chk) Int32Bounded(got int32, option BoundedOption, minV, maxV int32, msg ...any) bool
- func (chk *Chk) Int32Boundedf(got int32, option BoundedOption, minV, maxV int32, msgFmt string, ...) bool
- func (chk *Chk) Int32Slice(got, want []int32, msg ...any) bool
- func (chk *Chk) Int32Slicef(got, want []int32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int32Unbounded(got int32, option UnboundedOption, bound int32, msg ...any) bool
- func (chk *Chk) Int32Unboundedf(got int32, option UnboundedOption, bound int32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int32f(got, want int32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int64(got, want int64, msg ...any) bool
- func (chk *Chk) Int64Bounded(got int64, option BoundedOption, minV, maxV int64, msg ...any) bool
- func (chk *Chk) Int64Boundedf(got int64, option BoundedOption, minV, maxV int64, msgFmt string, ...) bool
- func (chk *Chk) Int64Slice(got, want []int64, msg ...any) bool
- func (chk *Chk) Int64Slicef(got, want []int64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int64Unbounded(got int64, option UnboundedOption, bound int64, msg ...any) bool
- func (chk *Chk) Int64Unboundedf(got int64, option UnboundedOption, bound int64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Int64f(got, want int64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) IntBounded(got int, option BoundedOption, minV, maxV int, msg ...any) bool
- func (chk *Chk) IntBoundedf(got int, option BoundedOption, minV, maxV int, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) IntSlice(got, want []int, msg ...any) bool
- func (chk *Chk) IntSlicef(got, want []int, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) IntUnbounded(got int, option UnboundedOption, bound int, msg ...any) bool
- func (chk *Chk) IntUnboundedf(got int, option UnboundedOption, bound int, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Intf(got, want int, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) KeepTmpFiles()
- func (*Chk) LastErr(args ...any) error
- func (chk *Chk) Log(wantLines ...string) bool
- func (chk *Chk) Logf(msgFmt string, msgArgs ...any)
- func (chk *Chk) Name() string
- func (chk *Chk) Nil(got any, msg ...any) bool
- func (chk *Chk) Nilf(got any, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) NoErr(got error, msg ...any) bool
- func (chk *Chk) NoErrf(got error, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) NoPanic(gotF func(), msg ...any) bool
- func (chk *Chk) NoPanicf(gotF func(), msgFmt string, msgArgs ...any) bool
- func (chk *Chk) NotNil(got any, msg ...any) bool
- func (chk *Chk) NotNilf(got any, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Panic(gotF func(), want string, msg ...any) bool
- func (chk *Chk) Panicf(gotF func(), want string, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) PushPostReleaseFunc(newFunc func() error)
- func (chk *Chk) PushPreReleaseFunc(newFunc func() error)
- func (chk *Chk) Read(dataBuf []byte) (int, error)
- func (chk *Chk) Release()
- func (chk *Chk) Rune(got, want rune, msg ...any) bool
- func (chk *Chk) RuneBounded(got rune, option BoundedOption, minV, maxV rune, msg ...any) bool
- func (chk *Chk) RuneBoundedf(got rune, option BoundedOption, minV, maxV rune, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) RuneSlice(got, want []rune, msg ...any) bool
- func (chk *Chk) RuneSlicef(got, want []rune, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) RuneUnbounded(got rune, option UnboundedOption, bound rune, msg ...any) bool
- func (chk *Chk) RuneUnboundedf(got rune, option UnboundedOption, bound rune, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Runef(got, want rune, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Seek(_ int64, _ int) (int64, error)
- func (chk *Chk) SetArgs(progName string, args ...string)
- func (chk *Chk) SetCloseError(err error)
- func (chk *Chk) SetEnv(name, value string)
- func (chk *Chk) SetIOReaderData(d ...string)
- func (chk *Chk) SetIOReaderError(byteCount int, err error)
- func (chk *Chk) SetIOWriterError(n int, err error)
- func (chk *Chk) SetPermDir(p os.FileMode) os.FileMode
- func (chk *Chk) SetPermExe(p os.FileMode) os.FileMode
- func (chk *Chk) SetPermFile(p os.FileMode) os.FileMode
- func (chk *Chk) SetReadError(pos int, err error)
- func (chk *Chk) SetSeekError(pos int64, err error)
- func (chk *Chk) SetStdinData(lines ...string)
- func (chk *Chk) SetTmpDir(dir string) string
- func (chk *Chk) SetWriteError(pos int, err error)
- func (chk *Chk) Stderr(wantLines ...string) bool
- func (chk *Chk) Stdout(wantLines ...string) bool
- func (chk *Chk) Str(got, want string, msg ...any) bool
- func (chk *Chk) StrBounded(got string, option BoundedOption, minV, maxV string, msg ...any) bool
- func (chk *Chk) StrBoundedf(got string, option BoundedOption, minV, maxV string, msgFmt string, ...) bool
- func (chk *Chk) StrSlice(got, want []string, msg ...any) bool
- func (chk *Chk) StrSlicef(got, want []string, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) StrUnbounded(got string, option UnboundedOption, bound string, msg ...any) bool
- func (chk *Chk) StrUnboundedf(got string, option UnboundedOption, bound string, msgFmt string, ...) bool
- func (chk *Chk) Strf(got, want string, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) T() testingT
- func (chk *Chk) True(got bool, msg ...any) bool
- func (chk *Chk) Truef(got bool, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint(got, want uint, msg ...any) bool
- func (chk *Chk) Uint8(got, want uint8, msg ...any) bool
- func (chk *Chk) Uint8Bounded(got uint8, option BoundedOption, minV, maxV uint8, msg ...any) bool
- func (chk *Chk) Uint8Boundedf(got uint8, option BoundedOption, minV, maxV uint8, msgFmt string, ...) bool
- func (chk *Chk) Uint8Slice(got, want []uint8, msg ...any) bool
- func (chk *Chk) Uint8Slicef(got, want []uint8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint8Unbounded(got uint8, option UnboundedOption, bound uint8, msg ...any) bool
- func (chk *Chk) Uint8Unboundedf(got uint8, option UnboundedOption, bound uint8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint8f(got, want uint8, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint16(got, want uint16, msg ...any) bool
- func (chk *Chk) Uint16Bounded(got uint16, option BoundedOption, minV, maxV uint16, msg ...any) bool
- func (chk *Chk) Uint16Boundedf(got uint16, option BoundedOption, minV, maxV uint16, msgFmt string, ...) bool
- func (chk *Chk) Uint16Slice(got, want []uint16, msg ...any) bool
- func (chk *Chk) Uint16Slicef(got, want []uint16, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint16Unbounded(got uint16, option UnboundedOption, bound uint16, msg ...any) bool
- func (chk *Chk) Uint16Unboundedf(got uint16, option UnboundedOption, bound uint16, msgFmt string, ...) bool
- func (chk *Chk) Uint16f(got, want uint16, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint32(got, want uint32, msg ...any) bool
- func (chk *Chk) Uint32Bounded(got uint32, option BoundedOption, minV, maxV uint32, msg ...any) bool
- func (chk *Chk) Uint32Boundedf(got uint32, option BoundedOption, minV, maxV uint32, msgFmt string, ...) bool
- func (chk *Chk) Uint32Slice(got, want []uint32, msg ...any) bool
- func (chk *Chk) Uint32Slicef(got, want []uint32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint32Unbounded(got uint32, option UnboundedOption, bound uint32, msg ...any) bool
- func (chk *Chk) Uint32Unboundedf(got uint32, option UnboundedOption, bound uint32, msgFmt string, ...) bool
- func (chk *Chk) Uint32f(got, want uint32, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint64(got, want uint64, msg ...any) bool
- func (chk *Chk) Uint64Bounded(got uint64, option BoundedOption, minV, maxV uint64, msg ...any) bool
- func (chk *Chk) Uint64Boundedf(got uint64, option BoundedOption, minV, maxV uint64, msgFmt string, ...) bool
- func (chk *Chk) Uint64Slice(got, want []uint64, msg ...any) bool
- func (chk *Chk) Uint64Slicef(got, want []uint64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uint64Unbounded(got uint64, option UnboundedOption, bound uint64, msg ...any) bool
- func (chk *Chk) Uint64Unboundedf(got uint64, option UnboundedOption, bound uint64, msgFmt string, ...) bool
- func (chk *Chk) Uint64f(got, want uint64, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) UintBounded(got uint, option BoundedOption, minV, maxV uint, msg ...any) bool
- func (chk *Chk) UintBoundedf(got uint, option BoundedOption, minV, maxV uint, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) UintSlice(got, want []uint, msg ...any) bool
- func (chk *Chk) UintSlicef(got, want []uint, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) UintUnbounded(got uint, option UnboundedOption, bound uint, msg ...any) bool
- func (chk *Chk) UintUnboundedf(got uint, option UnboundedOption, bound uint, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uintf(got, want uint, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uintptr(got, want uintptr, msg ...any) bool
- func (chk *Chk) UintptrSlice(got, want []uintptr, msg ...any) bool
- func (chk *Chk) UintptrSlicef(got, want []uintptr, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Uintptrf(got, want uintptr, msgFmt string, msgArgs ...any) bool
- func (chk *Chk) Write(data []byte) (int, error)
- type UnboundedOption
Constants ¶
const ( EnvFailFast = "SZTEST_FAIL_FAST" EnvBufferSize = "SZTEST_BUFFER_SIZE" EnvPermDir = "SZTEST_PERM_DIR" EnvPermFile = "SZTEST_PERM_FILE" EnvPermExe = "SZTEST_PERM_EXE" EnvTmpDir = "SZTEST_TMP_DIR" EnvDiffChars = "SZTEST_DIFF_CHARS" EnvDiffSlice = "SZTEST_DIFF_SLICE" EnvMarkWntOn = "SZTEST_MARK_WNT_ON" EnvMarkWntOff = "SZTEST_MARK_WNT_OFF" EnvMarkGotOn = "SZTEST_MARK_GOT_ON" EnvMarkGotOff = "SZTEST_MARK_GOT_OFF" EnvMarkMsgOn = "SZTEST_MARK_MSG_ON" EnvMarkMsgOff = "SZTEST_MARK_MSG_OFF" EnvMarkInsOn = "SZTEST_MARK_INS_ON" EnvMarkInsOff = "SZTEST_MARK_INS_OFF" EnvMarkDelOn = "SZTEST_MARK_DEL_ON" EnvMarkDelOff = "SZTEST_MARK_DEL_OFF" EnvMarkChgOn = "SZTEST_MARK_CHG_ON" EnvMarkChgOff = "SZTEST_MARK_CHG_OFF" EnvMarkSepOn = "SZTEST_MARK_SEP_ON" EnvMarkSepOff = "SZTEST_MARK_SEP_OFF" )
Environment variable identifiers.
const ( ClockSubNone = 0 // No substitutions. ClockSubTime = 1 << iota // {{clkTime#}} = HHmmSS. ClockSubDate // {{clkDate#}} = YYYYMMDD. ClockSubTS // {{clkTS#}} = YYYYMMDDHHmmSS. ClockSubNano // {{clkNano#}} = YYYYMMDDHHmmSS.#########. ClockSubCusA // {{clkCusA#}} = definable format string. ClockSubCusB // {{clkCusB#}} = definable format string. ClockSubCusC // {{clkCusC#}} = definable format string. ClockSubAll = math.MaxInt // All defined substitutions. )
Clock substitutions.
const ( DiffWant = diffType('W') DiffGot = diffType('G') DiffMerge = diffType('M') )
Represents the type of output displayed when diffing strings.
const ( SubTimestamp = `\d?\d:\d?\d:\d?\d(?:\.?\d{1,9})?` SubDuration = `\d+(?:\.?\d+)?(?:ns|us|µs|ms|s|m|h)` )
Builtin replacement regular expressions.
const BlankErrorMessage = "sztest.BlankErrorMessage"
BlankErrorMessage represents an empty panic message received.
const BlankPanicMessage = "sztest.BlankPanicMessage"
BlankPanicMessage represents an empty panic message received.
Variables ¶
var ( ErrInvalidLastArg = errors.New("invalid last arg error") ErrInvalidDirectory = errors.New("invalid directory") ErrInvalidFile = errors.New("invalid file") ErrReadPastEndOfData = errors.New("read past end of data") ErrForcedOutOfSpace = errors.New("forced out of space") )
Exported errors.
Functions ¶
func CompareArrays ¶
func CompareArrays[T chkType](got, wnt []T) string
CompareArrays returns "" an empty string if there are no differences otherwise it returns a string outlining the differences.
func CompareSlices ¶
func CompareSlices[T chkType]( title string, got, want []T, minRunSlice, minRunString int, cmp func(a, b T) bool, _ func(any) string, ) string
CompareSlices checks two slices for differences.
func DiffSlice ¶
func DiffSlice[T chkType]( gotSlice, wntSlice []T, dFmt *diffLnFmt, changed *bool, minRunSlice int, minRunString int, cmp func(a, b T) bool, ) []string
DiffSlice compares two Slices.
func DiffString ¶
DiffString checks two strings for differences.
func IsFloat32Similar ¶
IsFloat32Similar compares two floats to see if they match within the specified tolerance.
func IsFloat64Similar ¶
IsFloat64Similar compares two floats to see if they match within the specified tolerance.
func ReloadSettings ¶
func ReloadSettings()
ReloadSettings re-initializes the settings permitting an application to force certain settings required for embedded runs.
func SettingBufferSize ¶
func SettingBufferSize() int
SettingBufferSize returns the default setting overridden by env settings.
func SettingDiffChars ¶
func SettingDiffChars() int
SettingDiffChars returns the default setting overridden by env settings.
func SettingDiffSlice ¶
func SettingDiffSlice() int
SettingDiffSlice returns the default setting overridden by env settings.
func SettingFailFast ¶
func SettingFailFast() bool
SettingFailFast returns the default setting overridden by env settings.
func SettingMarkChgOff ¶
func SettingMarkChgOff() string
SettingMarkChgOff returns the default setting overridden by env settings.
func SettingMarkChgOn ¶
func SettingMarkChgOn() string
SettingMarkChgOn returns the default setting overridden by env settings.
func SettingMarkDelOff ¶
func SettingMarkDelOff() string
SettingMarkDelOff returns the default setting overridden by env settings.
func SettingMarkDelOn ¶
func SettingMarkDelOn() string
SettingMarkDelOn returns the default setting overridden by env settings.
func SettingMarkGotOff ¶
func SettingMarkGotOff() string
SettingMarkGotOff returns the default setting overridden by env settings.
func SettingMarkGotOn ¶
func SettingMarkGotOn() string
SettingMarkGotOn returns the default setting overridden by env settings.
func SettingMarkInsOff ¶
func SettingMarkInsOff() string
SettingMarkInsOff returns the default setting overridden by env settings.
func SettingMarkInsOn ¶
func SettingMarkInsOn() string
SettingMarkInsOn returns the default setting overridden by env settings.
func SettingMarkMsgOff ¶
func SettingMarkMsgOff() string
SettingMarkMsgOff returns the default setting overridden by env settings.
func SettingMarkMsgOn ¶
func SettingMarkMsgOn() string
SettingMarkMsgOn returns the default setting overridden by env settings.
func SettingMarkSepOff ¶
func SettingMarkSepOff() string
SettingMarkSepOff returns the default setting overridden by env settings.
func SettingMarkSepOn ¶
func SettingMarkSepOn() string
SettingMarkSepOn returns the default setting overridden by env settings.
func SettingMarkWntOff ¶
func SettingMarkWntOff() string
SettingMarkWntOff returns the default setting overridden by env settings.
func SettingMarkWntOn ¶
func SettingMarkWntOn() string
SettingMarkWntOn returns the default setting overridden by env settings.
func SettingPermDir ¶
SettingPermDir returns the default setting overridden by env settings.
func SettingPermExe ¶
SettingPermExe returns the default setting overridden by env settings.
func SettingPermFile ¶
SettingPermFile returns the default setting overridden by env settings.
func SettingTmpDir ¶
func SettingTmpDir() string
SettingTmpDir returns the default setting overridden by env settings.
Types ¶
type BoundedOption ¶
type BoundedOption int
BoundedOption constant type.
const ( // BoundedOpen (a,b) = { x | a < x < b }. BoundedOpen BoundedOption = iota // BoundedClosed [a,b] = { x | a ≦ x ≦ b }. BoundedClosed // BoundedMinOpen (a,b] = { x | a < x ≦ b }. BoundedMinOpen // BoundedMaxClosed (a,b] = { x | a < x ≦ b }. BoundedMaxClosed // BoundedMaxOpen [a,b) = { x | a ≦ x < b }. BoundedMaxOpen // BoundedMinClosed [a,b) = { x | a ≦ x < b }. BoundedMinClosed )
type Chk ¶
type Chk struct {
// contains filtered or unexported fields
}
Chk structure provides a selector and data to perform testing functions.
func CaptureLog ¶
func CaptureLog(t testingT) *Chk
CaptureLog returns a new *sztest.Chk reference capturing:
- log.Writer() io.Writer
which must be tested by calling the methods:
- (*Chk).Log(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureLogAndStderr ¶
func CaptureLogAndStderr(t testingT) *Chk
CaptureLogAndStderr returns a new *sztest.Chk reference capturing:
- log.Writer() io.Writer - os.Stderr
which must be tested by calling the methods:
- (*Chk).Log(wantLines ...string) bool - (*Chk).Stderr(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureLogAndStderrAndStdout ¶
func CaptureLogAndStderrAndStdout(t testingT) *Chk
CaptureLogAndStderrAndStdout returns a new *sztest.Chk reference capturing:
- log.Writer() io.Writer - os.Stderr - os.Stdout
which must be tested by calling the methods:
- (*Chk).Log(wantLines ...string) bool - (*Chk).Stderr(wantLines ...string) bool - (*Chk).Stdout(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureLogAndStdout ¶
func CaptureLogAndStdout(t testingT) *Chk
CaptureLogAndStdout returns a new *sztest.Chk reference capturing:
- log.Writer() io.Writer - os.Stdout
which must be tested by calling the methods:
- (*Chk).Log(wantLines ...string) bool - (*Chk).Stdout(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureLogWithStderr ¶
func CaptureLogWithStderr(t testingT) *Chk
CaptureLogWithStderr returns a new *sztest.Chk reference combining and capturing:
- (log.Writer() io.Writer) + os.Stderr
which must be tested by calling ONE the methods:
- (*Chk).Log(wantLines ...string) bool - OR - (*Chk).Stderr(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureLogWithStderrAndStdout ¶
func CaptureLogWithStderrAndStdout(t testingT) *Chk
CaptureLogWithStderrAndStdout returns a new *sztest.Chk reference capturing:
- (log.Writer() io.Writer) + os.Stderr - os.Stdout
which must be tested by calling ONE the methods:
- (*Chk).Log(wantLines ...string) bool - OR - (*Chk).Stderr(wantLines ...string) bool
and the method:
- (*Chk).Stdout(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureNothing ¶
func CaptureNothing(t testingT) *Chk
CaptureNothing returns a new sztest object without any logs or standard io being captured.
func CaptureStderr ¶
func CaptureStderr(t testingT) *Chk
CaptureStderr returns a new *sztest.Chk reference capturing:
- os.Stderr
which must be tested by calling the method:
- (*Chk).Stderr(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureStderrAndStdout ¶
func CaptureStderrAndStdout(t testingT) *Chk
CaptureStderrAndStdout returns a new *sztest.Chk reference capturing:
- os.Stderr - os.Stdout
which must be tested by calling the methods:
- (*Chk).Stderr(wantLines ...string) bool - (*Chk).Stdout(wantLines ...string) bool
before (*Chk).Release() is invoked.
func CaptureStdout ¶
func CaptureStdout(t testingT) *Chk
CaptureStdout returns a new *sztest.Chk reference capturing:
- os.Stdout
which must be tested by calling the methods:
- (*Chk).Stdout(wantLines ...string) bool
before (*Chk).Release() is invoked.
func (*Chk) Bool ¶
Bool compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) BoolSlicef ¶
BoolSlicef checks two boolean slices for equality.
func (*Chk) Boolf ¶
Boolf compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Byte ¶
Byte compares the wanted byte against the gotten byte invoking an error should they not match.
func (*Chk) ByteBounded ¶
ByteBounded checks value is within specified bounded range.
func (*Chk) ByteBoundedf ¶
func (chk *Chk) ByteBoundedf( got byte, option BoundedOption, minV, maxV byte, msgFmt string, msgArgs ...any, ) bool
ByteBoundedf checks value is within specified bounded range.
func (*Chk) ByteSlicef ¶
ByteSlicef checks two byte slices for equality.
func (*Chk) ByteUnbounded ¶
ByteUnbounded checks value is within specified unbounded range.
func (*Chk) ByteUnboundedf ¶
func (chk *Chk) ByteUnboundedf( got byte, option UnboundedOption, bound byte, msgFmt string, msgArgs ...any, ) bool
ByteUnboundedf checks value is within specified unbounded range.
func (*Chk) Bytef ¶
Bytef compares the wanted byte against the gotten byte invoking an error should they not match.
func (*Chk) CaptureFlagUsage ¶
CaptureFlagUsage is a convenience function that captures the output of the provided *flag.FlagSet.
func (*Chk) ClockAddSub ¶
ClockAddSub sets the fields to set substitutions for.
func (*Chk) ClockLastFmtCusA ¶
ClockLastFmtCusA returns the last time generated in the indicated format.
func (*Chk) ClockLastFmtCusB ¶
ClockLastFmtCusB returns the last time generated in the indicated format.
func (*Chk) ClockLastFmtCusC ¶
ClockLastFmtCusC returns the last time generated in the indicated format.
func (*Chk) ClockLastFmtDate ¶
ClockLastFmtDate returns the last time generated in the indicated format.
func (*Chk) ClockLastFmtNano ¶
ClockLastFmtNano returns the last time generated in the indicated format.
func (*Chk) ClockLastFmtTS ¶
ClockLastFmtTS returns the last time generated in the indicated format.
func (*Chk) ClockLastFmtTime ¶
ClockLastFmtTime returns the last time generated in the indicated format.
func (*Chk) ClockNext ¶
ClockNext returns the current time or the next time sequence if a clock has been set.
func (*Chk) ClockNextFmtCusA ¶
ClockNextFmtCusA returns the last time generated in the indicated format.
func (*Chk) ClockNextFmtCusB ¶
ClockNextFmtCusB returns the last time generated in the indicated format.
func (*Chk) ClockNextFmtCusC ¶
ClockNextFmtCusC returns the last time generated in the indicated format.
func (*Chk) ClockNextFmtDate ¶
ClockNextFmtDate returns the last time generated in the indicated format.
func (*Chk) ClockNextFmtNano ¶
ClockNextFmtNano returns the last time generated in the indicated format.
func (*Chk) ClockNextFmtTS ¶
ClockNextFmtTS returns the last time generated in the indicated format.
func (*Chk) ClockNextFmtTime ¶
ClockNextFmtTime returns the last time generated in the indicated format.
func (*Chk) ClockOffset ¶
ClockOffset moves the current clock by the specified amount. No defined increments are applied and if a clock has not yet been set the current time advanced by the specified amount will be used. Nothing is returned.
func (*Chk) ClockOffsetDay ¶
ClockOffsetDay adjusts the current clock by the number of specified days with negative numbers representing the past. It returns a func to reset the clk back to its state when this function was called.
func (*Chk) ClockRemoveSub ¶
ClockRemoveSub resets the fields to set substitutions for.
func (*Chk) ClockSet ¶
ClockSet set the current test time and optionally sets the increments if provided. It returns a func to reset the clk back to its state when this function was called.
func (*Chk) ClockSetCusA ¶
ClockSetCusA sets the custom date format to set tick substitution values.
func (*Chk) ClockSetCusB ¶
ClockSetCusB sets the custom date format to set tick substitution values.
func (*Chk) ClockSetCusC ¶
ClockSetCusC sets the custom date format to set tick substitution values.
func (*Chk) ClockSetSub ¶
ClockSetSub sets the fields to set substitutions for.
func (*Chk) Close ¶
Close implements the interface to simulate a close operation returning an error if provided.
func (*Chk) Complex64 ¶
Complex64 compares the wanted complex64 against the gotten complex64 invoking an error should they not match.
func (*Chk) Complex64Slice ¶
Complex64Slice checks two complex64 slices for equality.
func (*Chk) Complex64Slicef ¶
Complex64Slicef checks two complex64 slices for equality.
func (*Chk) Complex64f ¶
Complex64f compares the wanted complex64 against the gotten complex64 invoking an error should they not match.
func (*Chk) Complex128 ¶
func (chk *Chk) Complex128(got, want complex128, msg ...any) bool
Complex128 compares the wanted complex128 against the gotten complex128 invoking an error should they not match.
func (*Chk) Complex128Slice ¶
func (chk *Chk) Complex128Slice( got, want []complex128, msg ...any, ) bool
Complex128Slice checks two complex128 slices for equality.
func (*Chk) Complex128Slicef ¶
func (chk *Chk) Complex128Slicef( got, want []complex128, msgFmt string, msgArgs ...any, ) bool
Complex128Slicef checks two complex128 slices for equality.
func (*Chk) Complex128f ¶
func (chk *Chk) Complex128f( got, want complex128, msgFmt string, msgArgs ...any, ) bool
Complex128f compares the wanted complex128 against the gotten complex128 invoking an error should they not match.
func (*Chk) CreateTmpDir ¶
CreateTmpDir creates a temporary test directory using the test functions name in the /tmp directory.
func (*Chk) CreateTmpFile ¶
CreateTmpFile removes and creates the named directory with the provided permissions.
func (*Chk) CreateTmpFileAs ¶
CreateTmpFileAs removes and creates the named file in the provided path.
func (*Chk) CreateTmpFileIn ¶
CreateTmpFileIn removes and creates a tmp file in the provided path.
func (*Chk) CreateTmpSubDir ¶
CreateTmpSubDir creates a temporary test directory using the test functions name in the /tmp directory.
func (*Chk) CreateTmpUnixScript ¶
CreateTmpUnixScript removes and creates the named directory with the provided permissions.
func (*Chk) CreateTmpUnixScriptAs ¶
CreateTmpUnixScriptAs removes and creates the named script with the provided permissions.
func (*Chk) CreateTmpUnixScriptIn ¶
CreateTmpUnixScriptIn removes and creates the generated script name with the provided permissions.
func (*Chk) DelEnv ¶
DelEnv removes the env variable if it exists. Any changes are reversed when chk.Release() is called.
func (*Chk) Dur ¶
Dur compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) DurBounded ¶
func (chk *Chk) DurBounded( got time.Duration, option BoundedOption, minV, maxV time.Duration, msg ...any, ) bool
DurBounded checks value is within specified bounded range.
func (*Chk) DurBoundedf ¶
func (chk *Chk) DurBoundedf( got time.Duration, option BoundedOption, minV, maxV time.Duration, msgFmt string, msgArgs ...any, ) bool
DurBoundedf checks value is within specified bounded range.
func (*Chk) DurUnbounded ¶
func (chk *Chk) DurUnbounded( got time.Duration, option UnboundedOption, bound time.Duration, msg ...any, ) bool
DurUnbounded checks value is within specified unbounded range.
func (*Chk) DurUnboundedf ¶
func (chk *Chk) DurUnboundedf( got time.Duration, option UnboundedOption, bound time.Duration, msgFmt string, msgArgs ...any, ) bool
DurUnboundedf checks value is within specified unbounded range.
func (*Chk) Durf ¶
Durf compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Err ¶
Err compare the gotten error against the wanted error string. If either "" or "<nil>" is wanted the error should be a nil.
func (*Chk) ErrChain ¶ added in v0.1.1
ErrChain returns a string concatenating all of the errors and strings with the separator.
func (*Chk) ErrSlice ¶
ErrSlice compare the gotten error against the wanted error string. If either "" or "<nil>" is wanted the error should be a nil.
func (*Chk) ErrSlicef ¶
ErrSlicef compare the gotten error against the wanted error string. If either "" or "<nil>" is wanted the error should be a nil.
func (*Chk) Errf ¶
Errf compare the gotten error against the wanted error string. If either "" or "<nil>" is wanted the error should be a nil.
func (*Chk) Float32 ¶
Float32 compares the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float32Bounded ¶
func (chk *Chk) Float32Bounded( got float32, option BoundedOption, minV, maxV float32, msg ...any, ) bool
Float32Bounded checks value is within specified bounded range.
func (*Chk) Float32Boundedf ¶
func (chk *Chk) Float32Boundedf( got float32, option BoundedOption, minV, maxV float32, msgFmt string, msgArgs ...any, ) bool
Float32Boundedf checks value is within specified bounded range.
func (*Chk) Float32Slice ¶
Float32Slice compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float32Slicef ¶
func (chk *Chk) Float32Slicef( got, want []float32, tolerance float32, msgFmt string, msgArgs ...any, ) bool
Float32Slicef compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float32Unbounded ¶
func (chk *Chk) Float32Unbounded( got float32, option UnboundedOption, bound float32, msg ...any, ) bool
Float32Unbounded checks value is within specified unbounded range.
func (*Chk) Float32Unboundedf ¶
func (chk *Chk) Float32Unboundedf( got float32, option UnboundedOption, bound float32, msgFmt string, msgArgs ...any, ) bool
Float32Unboundedf checks value is within specified unbounded range.
func (*Chk) Float32f ¶
Float32f compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float64 ¶
Float64 compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float64Bounded ¶
func (chk *Chk) Float64Bounded( got float64, option BoundedOption, minV, maxV float64, msg ...any, ) bool
Float64Bounded checks value is within specified bounded range.
func (*Chk) Float64Boundedf ¶
func (chk *Chk) Float64Boundedf( got float64, option BoundedOption, minV, maxV float64, msgFmt string, msgArgs ...any, ) bool
Float64Boundedf checks value is within specified bounded range.
func (*Chk) Float64Slice ¶
Float64Slice compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float64Slicef ¶
func (chk *Chk) Float64Slicef( got, want []float64, tolerance float64, msgFmt string, msgArgs ...any, ) bool
Float64Slicef compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) Float64Unbounded ¶
func (chk *Chk) Float64Unbounded( got float64, option UnboundedOption, bound float64, msg ...any, ) bool
Float64Unbounded checks value is within specified unbounded range.
func (*Chk) Float64Unboundedf ¶
func (chk *Chk) Float64Unboundedf( got float64, option UnboundedOption, bound float64, msgFmt string, msgArgs ...any, ) bool
Float64Unboundedf checks value is within specified unbounded range.
func (*Chk) Float64f ¶
Float64f compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) GetIOWriterData ¶
GetIOWriterData returns the bytes received on the ioWriter interface.
func (*Chk) Int ¶
Int compares the wanted int against the gotten int invoking an error should they not match.
func (*Chk) Int8 ¶
Int8 compares the wanted int8 against the gotten int8 invoking an error should they not match.
func (*Chk) Int8Bounded ¶
Int8Bounded checks value is within specified bounded range.
func (*Chk) Int8Boundedf ¶
func (chk *Chk) Int8Boundedf( got int8, option BoundedOption, minV, maxV int8, msgFmt string, msgArgs ...any, ) bool
Int8Boundedf checks value is within specified bounded range.
func (*Chk) Int8Slicef ¶
Int8Slicef checks two int8 slices for equality.
func (*Chk) Int8Unbounded ¶
Int8Unbounded checks value is within specified unbounded range.
func (*Chk) Int8Unboundedf ¶
func (chk *Chk) Int8Unboundedf( got int8, option UnboundedOption, bound int8, msgFmt string, msgArgs ...any, ) bool
Int8Unboundedf checks value is within specified unbounded range.
func (*Chk) Int8f ¶
Int8f compares the wanted int8 against the gotten int8 invoking an error should they not match.
func (*Chk) Int16 ¶
Int16 compares the wanted int16 against the gotten int16 invoking an error should they not match.
func (*Chk) Int16Bounded ¶
Int16Bounded checks value is within specified bounded range.
func (*Chk) Int16Boundedf ¶
func (chk *Chk) Int16Boundedf( got int16, option BoundedOption, minV, maxV int16, msgFmt string, msgArgs ...any, ) bool
Int16Boundedf checks value is within specified bounded range.
func (*Chk) Int16Slice ¶
Int16Slice checks two int16 slices for equality.
func (*Chk) Int16Slicef ¶
Int16Slicef checks two int16 slices for equality.
func (*Chk) Int16Unbounded ¶
Int16Unbounded checks value is within specified unbounded range.
func (*Chk) Int16Unboundedf ¶
func (chk *Chk) Int16Unboundedf( got int16, option UnboundedOption, bound int16, msgFmt string, msgArgs ...any, ) bool
Int16Unboundedf checks value is within specified unbounded range.
func (*Chk) Int16f ¶
Int16f compares the wanted int16 against the gotten int16 invoking an error should they not match.
func (*Chk) Int32 ¶
Int32 compares the wanted int32 against the gotten int32 invoking an error should they not match.
func (*Chk) Int32Bounded ¶
Int32Bounded checks value is within specified bounded range.
func (*Chk) Int32Boundedf ¶
func (chk *Chk) Int32Boundedf( got int32, option BoundedOption, minV, maxV int32, msgFmt string, msgArgs ...any, ) bool
Int32Boundedf checks value is within specified bounded range.
func (*Chk) Int32Slice ¶
Int32Slice checks two int32 slices for equality.
func (*Chk) Int32Slicef ¶
Int32Slicef checks two int32 slices for equality.
func (*Chk) Int32Unbounded ¶
Int32Unbounded checks value is within specified unbounded range.
func (*Chk) Int32Unboundedf ¶
func (chk *Chk) Int32Unboundedf( got int32, option UnboundedOption, bound int32, msgFmt string, msgArgs ...any, ) bool
Int32Unboundedf checks value is within specified unbounded range.
func (*Chk) Int32f ¶
Int32f compares the wanted int32 against the gotten int32 invoking an error should they not match.
func (*Chk) Int64 ¶
Int64 compares the wanted int64 against the gotten int64 invoking an error should they not match.
func (*Chk) Int64Bounded ¶
Int64Bounded checks value is within specified bounded range.
func (*Chk) Int64Boundedf ¶
func (chk *Chk) Int64Boundedf( got int64, option BoundedOption, minV, maxV int64, msgFmt string, msgArgs ...any, ) bool
Int64Boundedf checks value is within specified bounded range.
func (*Chk) Int64Slice ¶
Int64Slice checks two int64 slices for equality.
func (*Chk) Int64Slicef ¶
Int64Slicef checks two int64 slices for equality.
func (*Chk) Int64Unbounded ¶
Int64Unbounded checks value is within specified unbounded range.
func (*Chk) Int64Unboundedf ¶
func (chk *Chk) Int64Unboundedf( got int64, option UnboundedOption, bound int64, msgFmt string, msgArgs ...any, ) bool
Int64Unboundedf checks value is within specified unbounded range.
func (*Chk) Int64f ¶
Int64f compares the wanted int64 against the gotten int64 invoking an error should they not match.
func (*Chk) IntBounded ¶
IntBounded checks value is within specified bounded range.
func (*Chk) IntBoundedf ¶
func (chk *Chk) IntBoundedf( got int, option BoundedOption, minV, maxV int, msgFmt string, msgArgs ...any, ) bool
IntBoundedf checks value is within specified bounded range.
func (*Chk) IntUnbounded ¶
IntUnbounded checks value is within specified unbounded range.
func (*Chk) IntUnboundedf ¶
func (chk *Chk) IntUnboundedf( got int, option UnboundedOption, bound int, msgFmt string, msgArgs ...any, ) bool
IntUnboundedf checks value is within specified unbounded range.
func (*Chk) Intf ¶
Intf compares the wanted int against the gotten int invoking an error should they not match.
func (*Chk) KeepTmpFiles ¶
func (chk *Chk) KeepTmpFiles()
KeepTmpFiles stops the removal of tmp files when the check is fault free.
func (*Chk) LastErr ¶
LastErr returns the last argument in the list as an error. If there are no arguments or the last parameter is not an Error interface then ErrInvalidLastErrArg is returned.
func (*Chk) Panic ¶
Panic runs the supplied function and compares the panic value asserted to the supplied string.
func (*Chk) Panicf ¶
Panicf runs the supplied function and compares the panic value asserted to the supplied string.
func (*Chk) PushPostReleaseFunc ¶
PushPostReleaseFunc adds a new release function to the end of the queue.
func (*Chk) PushPreReleaseFunc ¶
PushPreReleaseFunc adds a new release function to the front of the queue.
func (*Chk) Rune ¶
Rune compares the wanted rune against the gotten rune invoking an error should they not match.
func (*Chk) RuneBounded ¶
RuneBounded checks value is within specified bounded range.
func (*Chk) RuneBoundedf ¶
func (chk *Chk) RuneBoundedf( got rune, option BoundedOption, minV, maxV rune, msgFmt string, msgArgs ...any, ) bool
RuneBoundedf checks value is within specified bounded range.
func (*Chk) RuneSlicef ¶
RuneSlicef checks two rune slices for equality.
func (*Chk) RuneUnbounded ¶
RuneUnbounded checks value is within specified unbounded range.
func (*Chk) RuneUnboundedf ¶
func (chk *Chk) RuneUnboundedf( got rune, option UnboundedOption, bound rune, msgFmt string, msgArgs ...any, ) bool
RuneUnboundedf checks value is within specified unbounded range.
func (*Chk) Runef ¶
Runef compares the wanted rune against the gotten rune invoking an error should they not match.
func (*Chk) Seek ¶
Seek implements the interface to simulate a Seek operation returning an error if provided.
func (*Chk) SetArgs ¶ added in v0.0.1
SetArgs invokes the current arguments in os.Args and flag.CommandLine. Package variable os.Args is set to the provided arguments and a new flag set is assigned to flag.CommandLine and is ready to use. Original values are restores with the chk object is released.
func (*Chk) SetCloseError ¶
SetCloseError primes the chk object to return the provided error.
func (*Chk) SetEnv ¶
SetEnv adds or modifies the names environment variable to the specified value. Any Changes made are reset when chk.Release() is called.
func (*Chk) SetIOReaderData ¶
SetIOReaderData initializes the IO reader interface for testing.
func (*Chk) SetIOReaderError ¶
SetIOReaderError initializes the IO reader to return en error after the specified number of bytes have been read.
func (*Chk) SetIOWriterError ¶
SetIOWriterError provides to limit the amount of bytes that will be read before an error (or the supplied error will be returned.)
func (*Chk) SetPermDir ¶
SetPermDir changes the os.FileMode used when creating directories and returns the current value.
func (*Chk) SetPermExe ¶
SetPermExe changes the os.FileMode used when creating directories and returns the current value.
func (*Chk) SetPermFile ¶
SetPermFile changes the os.FileMode used when creating directories and returns the current value.
func (*Chk) SetReadError ¶
SetReadError primes the chk object to return the provided error on the next read operation.
func (*Chk) SetSeekError ¶
SetSeekError primes the chk object to return the provided error.
func (*Chk) SetStdinData ¶
SetStdinData sets the os.Stdin to stream the provided data.
func (*Chk) SetTmpDir ¶
SetTmpDir changes the root directory used when creating directories and returns the current value.
func (*Chk) SetWriteError ¶
SetWriteError primes the chk object to return the provided error on the next Write operation.
func (*Chk) Str ¶
Str compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) StrBounded ¶
StrBounded checks value is within specified bounded range.
func (*Chk) StrBoundedf ¶
func (chk *Chk) StrBoundedf( got string, option BoundedOption, minV, maxV string, msgFmt string, msgArgs ...any, ) bool
StrBoundedf checks value is within specified bounded range.
func (*Chk) StrUnbounded ¶
StrUnbounded checks value is within specified unbounded range.
func (*Chk) StrUnboundedf ¶
func (chk *Chk) StrUnboundedf( got string, option UnboundedOption, bound string, msgFmt string, msgArgs ...any, ) bool
StrUnboundedf checks value is within specified unbounded range.
func (*Chk) Strf ¶
Strf compare the wanted boolean against the gotten bool invoking an error should they not match.
func (*Chk) T ¶
func (chk *Chk) T() testingT
T returns an interface to sztest object provided on creation.
func (*Chk) Uint ¶
Uint compares the wanted uint against the gotten uint invoking an error should they not match.
func (*Chk) Uint8 ¶
Uint8 compares the wanted uint8 against the gotten uint8 invoking an error should they not match.
func (*Chk) Uint8Bounded ¶
Uint8Bounded checks value is within specified bounded range.
func (*Chk) Uint8Boundedf ¶
func (chk *Chk) Uint8Boundedf( got uint8, option BoundedOption, minV, maxV uint8, msgFmt string, msgArgs ...any, ) bool
Uint8Boundedf checks value is within specified bounded range.
func (*Chk) Uint8Slice ¶
Uint8Slice checks two uint8 slices for equality.
func (*Chk) Uint8Slicef ¶
Uint8Slicef checks two uint8 slices for equality.
func (*Chk) Uint8Unbounded ¶
Uint8Unbounded checks value is within specified unbounded range.
func (*Chk) Uint8Unboundedf ¶
func (chk *Chk) Uint8Unboundedf( got uint8, option UnboundedOption, bound uint8, msgFmt string, msgArgs ...any, ) bool
Uint8Unboundedf checks value is within specified unbounded range.
func (*Chk) Uint8f ¶
Uint8f compares the wanted uint8 against the gotten uint8 invoking an error should they not match.
func (*Chk) Uint16 ¶
Uint16 compares the wanted uint16 against the gotten uint16 invoking an error should they not match.
func (*Chk) Uint16Bounded ¶
func (chk *Chk) Uint16Bounded( got uint16, option BoundedOption, minV, maxV uint16, msg ...any, ) bool
Uint16Bounded checks value is within specified bounded range.
func (*Chk) Uint16Boundedf ¶
func (chk *Chk) Uint16Boundedf( got uint16, option BoundedOption, minV, maxV uint16, msgFmt string, msgArgs ...any, ) bool
Uint16Boundedf checks value is within specified bounded range.
func (*Chk) Uint16Slice ¶
Uint16Slice checks two uint16 slices for equality.
func (*Chk) Uint16Slicef ¶
Uint16Slicef checks two uint16 slices for equality.
func (*Chk) Uint16Unbounded ¶
func (chk *Chk) Uint16Unbounded( got uint16, option UnboundedOption, bound uint16, msg ...any, ) bool
Uint16Unbounded checks value is within specified unbounded range.
func (*Chk) Uint16Unboundedf ¶
func (chk *Chk) Uint16Unboundedf( got uint16, option UnboundedOption, bound uint16, msgFmt string, msgArgs ...any, ) bool
Uint16Unboundedf checks value is within specified unbounded range.
func (*Chk) Uint16f ¶
Uint16f compares the wanted uint16 against the gotten uint16 invoking an error should they not match.
func (*Chk) Uint32 ¶
Uint32 compares the wanted uint32 against the gotten uint32 invoking an error should they not match.
func (*Chk) Uint32Bounded ¶
func (chk *Chk) Uint32Bounded( got uint32, option BoundedOption, minV, maxV uint32, msg ...any, ) bool
Uint32Bounded checks value is within specified bounded range.
func (*Chk) Uint32Boundedf ¶
func (chk *Chk) Uint32Boundedf( got uint32, option BoundedOption, minV, maxV uint32, msgFmt string, msgArgs ...any, ) bool
Uint32Boundedf checks value is within specified bounded range.
func (*Chk) Uint32Slice ¶
Uint32Slice checks two uint32 slices for equality.
func (*Chk) Uint32Slicef ¶
Uint32Slicef checks two uint32 slices for equality.
func (*Chk) Uint32Unbounded ¶
func (chk *Chk) Uint32Unbounded( got uint32, option UnboundedOption, bound uint32, msg ...any, ) bool
Uint32Unbounded checks value is within specified unbounded range.
func (*Chk) Uint32Unboundedf ¶
func (chk *Chk) Uint32Unboundedf( got uint32, option UnboundedOption, bound uint32, msgFmt string, msgArgs ...any, ) bool
Uint32Unboundedf checks value is within specified unbounded range.
func (*Chk) Uint32f ¶
Uint32f compares the wanted uint32 against the gotten uint32 invoking an error should they not match.
func (*Chk) Uint64 ¶
Uint64 compares the wanted uint64 against the gotten uint64 invoking an error should they not match.
func (*Chk) Uint64Bounded ¶
func (chk *Chk) Uint64Bounded( got uint64, option BoundedOption, minV, maxV uint64, msg ...any, ) bool
Uint64Bounded checks value is within specified bounded range.
func (*Chk) Uint64Boundedf ¶
func (chk *Chk) Uint64Boundedf( got uint64, option BoundedOption, minV, maxV uint64, msgFmt string, msgArgs ...any, ) bool
Uint64Boundedf checks value is within specified bounded range.
func (*Chk) Uint64Slice ¶
Uint64Slice checks two uint64 slices for equality.
func (*Chk) Uint64Slicef ¶
Uint64Slicef checks two uint64 slices for equality.
func (*Chk) Uint64Unbounded ¶
func (chk *Chk) Uint64Unbounded( got uint64, option UnboundedOption, bound uint64, msg ...any, ) bool
Uint64Unbounded checks value is within specified unbounded range.
func (*Chk) Uint64Unboundedf ¶
func (chk *Chk) Uint64Unboundedf( got uint64, option UnboundedOption, bound uint64, msgFmt string, msgArgs ...any, ) bool
Uint64Unboundedf checks value is within specified unbounded range.
func (*Chk) Uint64f ¶
Uint64f compares the wanted uint64 against the gotten uint64 invoking an error should they not match.
func (*Chk) UintBounded ¶
UintBounded checks value is within specified bounded range.
func (*Chk) UintBoundedf ¶
func (chk *Chk) UintBoundedf( got uint, option BoundedOption, minV, maxV uint, msgFmt string, msgArgs ...any, ) bool
UintBoundedf checks value is within specified bounded range.
func (*Chk) UintSlicef ¶
UintSlicef checks two uint slices for equality.
func (*Chk) UintUnbounded ¶
UintUnbounded checks value is within specified unbounded range.
func (*Chk) UintUnboundedf ¶
func (chk *Chk) UintUnboundedf( got uint, option UnboundedOption, bound uint, msgFmt string, msgArgs ...any, ) bool
UintUnboundedf checks value is within specified unbounded range.
func (*Chk) Uintf ¶
Uintf compares the wanted uint against the gotten uint invoking an error should they not match.
func (*Chk) Uintptr ¶
Uintptr compares the wanted uintptr against the gotten uintptr invoking an error should they not match.
func (*Chk) UintptrSlice ¶
UintptrSlice checks two uintptr slices for equality.
func (*Chk) UintptrSlicef ¶
UintptrSlicef checks two uintptr slices for equality.
type UnboundedOption ¶
type UnboundedOption int
UnboundedOption constant type.
const ( // UnboundedMinOpen (a,+∞) = { x | x > a }. UnboundedMinOpen UnboundedOption = iota // UnboundedMinClosed [a,+∞) = { x | x ≧ a }. UnboundedMinClosed // UnboundedMaxOpen (-∞, b) = { x | x < b }. UnboundedMaxOpen // UnboundedMaxClosed (-∞, b] = { x | x ≦ b }. UnboundedMaxClosed )
Source Files
¶
- cfg.go
- cfg_colors.go
- cfg_init.go
- cfg_validate.go
- chk.go
- ck_any.go
- ck_bool.go
- ck_byte.go
- ck_complex128.go
- ck_complex64.go
- ck_dur.go
- ck_err.go
- ck_err_last.go
- ck_float32.go
- ck_float64.go
- ck_int.go
- ck_int16.go
- ck_int32.go
- ck_int64.go
- ck_int8.go
- ck_log.go
- ck_panic.go
- ck_rune.go
- ck_str.go
- ck_uint.go
- ck_uint16.go
- ck_uint32.go
- ck_uint64.go
- ck_uint8.go
- ck_uintptr.go
- clock.go
- diff.go
- diff_fmt.go
- diff_markup.go
- dir.go
- env.go
- errs.go
- info.go
- io_close.go
- io_reader.go
- io_seek.go
- io_writer.go
- os_args_and_flags.go
- substitution.go
- testing_t.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
appendix/large_example_function
Package example demonstrates a larger test function.
|
Package example demonstrates a larger test function. |
|
io_interface/close_error
Package example shows various test options.
|
Package example shows various test options. |
|
io_interface/read_error
Package example shows various test options.
|
Package example shows various test options. |
|
io_interface/read_seek_error
Package example shows various test options.
|
Package example shows various test options. |
|
io_interface/write_error
Package example shows various test options.
|
Package example shows various test options. |
|
io_interface/write_seek_error
Package example shows various test options.
|
Package example shows various test options. |
|
timestamp/logging
Package example provides an example of using the sztest Clock utility to test code that uses relative timestamps.
|
Package example provides an example of using the sztest Clock utility to test code that uses relative timestamps. |