Documentation
¶
Overview ¶
Package must contains utilities for testing
Index ¶
- func Atoi(s string) int
- func B64(encoded string) []byte
- func Close(closer io.Closer)
- func DecodeBase64(encoding *base64.Encoding, encoded string) []byte
- func DecodeHex(encoded string) []byte
- func MarshalJSON(v interface{}) []byte
- func MarshalJSONPretty(v interface{}) []byte
- func NotFail(err error)
- func ParseTime(s string) time.Time
- func ParseURL(s string) *url.URL
- func ReadFile(filename string) []byte
- func ReadFileFS(fs fs.FS, filename string) []byte
- func ReadRandomBytes(n int) []byte
- func ReadRandomInteger(maxValue uint64) uint64
- func Return[T any](value T, err error) T
- func UnmarshalJSON[T any](data []byte) T
- func WriteFile(filename string, content []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64 ¶
DecodeBase64 decodes the base64 encoded string in encoded, or panics if it is not a valid string.
func DecodeHex ¶
DecodeHex decodes the hex-encoded string in encoded, or panics if it is not a valid string.
func MarshalJSON ¶
func MarshalJSON(v interface{}) []byte
MarshalJSON returns the JSON encoding of v, or panics if v cannot be encoded.
func MarshalJSONPretty ¶
func MarshalJSONPretty(v interface{}) []byte
MarshalJSONPretty returns the JSON encoding of v, or panics if v cannot be encoded.
func ParseTime ¶
ParseTime returns the time.Time value represented by the string s in RFC3339 format.
func ReadFileFS ¶
ReadFileFS returns the contents of the specified file.
func ReadRandomBytes ¶
ReadRandomBytes returns a random buffer of length n, or panics if bytes cannot be obtained.
Uses thunks.RandReader as the source of randomness.
func ReadRandomInteger ¶
ReadRandomInteger returns an integer between [0, maxValue). It panics if max = 0 or if random bytes cannot be read.
func Return ¶
Return is useful for functions returning (value, error). It panics if err is not nil, otherwise it returns the value.
func UnmarshalJSON ¶
UnmarshalJSON parses JSON-encoded data, or panics if data cannot be decoded.
Types ¶
This section is empty.