v0.0.292
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m11s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m11s
This commit is contained in:
parent
42b68507f2
commit
19ee5019ef
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.291"
|
const GoextVersion = "0.0.292"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-10-26T13:02:45+0200"
|
const GoextVersionTimestamp = "2023-10-30T10:14:38+0100"
|
||||||
|
21
tst/must.go
Normal file
21
tst/must.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package tst
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime/debug"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Must can b used to AssertNoErr of an (T, err) function
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
//
|
||||||
|
// input := "123.8"
|
||||||
|
// value := tst.Must(strconv.Atoi(input))(t)
|
||||||
|
func Must[T any](v T, anerr error) func(t *testing.T) T {
|
||||||
|
return func(t *testing.T) T {
|
||||||
|
if anerr != nil {
|
||||||
|
t.Error("Function returned an error: " + anerr.Error() + "\n" + string(debug.Stack()))
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user