Change-Id: I140c39b9dceaaeb58767061b131777af22242b19 Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
29 lines
464 B
Go
29 lines
464 B
Go
package assert
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func True(cond bool, details ...string) {
|
|
if !cond {
|
|
panic(strings.Join(details, " "))
|
|
}
|
|
}
|
|
|
|
func False(cond bool, details ...string) {
|
|
if cond {
|
|
panic(strings.Join(details, " "))
|
|
}
|
|
}
|
|
|
|
func NoError(err error, details ...string) {
|
|
if err != nil {
|
|
content := fmt.Sprintf("BUG: %v: %s", err, strings.Join(details, " "))
|
|
panic(content)
|
|
}
|
|
}
|
|
|
|
func Fail(details ...string) {
|
|
panic(strings.Join(details, " "))
|
|
}
|