forked from TrueCloudLab/frostfs-node
[#1693] internal/assert: Add False
and NoError
checks
Change-Id: Ib3ab1671eeff8e8917673513477f158cadbb4287 Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
f4696e8964
commit
4c03561aa2
1 changed files with 17 additions and 1 deletions
|
@ -1,9 +1,25 @@
|
||||||
package assert
|
package assert
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func True(cond bool, details ...string) {
|
func True(cond bool, details ...string) {
|
||||||
if !cond {
|
if !cond {
|
||||||
panic(strings.Join(details, " "))
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue