[#1693] internal/assert: Add False
and NoError
checks
Some checks failed
Tests and linters / gopls check (push) Failing after 59s
Vulncheck / Vulncheck (push) Successful in 1m12s
Pre-commit hooks / Pre-commit (push) Successful in 1m35s
Build / Build Components (push) Successful in 1m49s
Tests and linters / Run gofumpt (push) Successful in 3m29s
Tests and linters / Staticcheck (push) Successful in 3m52s
Tests and linters / Lint (push) Successful in 4m30s
Tests and linters / Tests (push) Successful in 4m31s
OCI image / Build container images (push) Successful in 4m54s
Tests and linters / Tests with -race (push) Successful in 6m51s
Some checks failed
Tests and linters / gopls check (push) Failing after 59s
Vulncheck / Vulncheck (push) Successful in 1m12s
Pre-commit hooks / Pre-commit (push) Successful in 1m35s
Build / Build Components (push) Successful in 1m49s
Tests and linters / Run gofumpt (push) Successful in 3m29s
Tests and linters / Staticcheck (push) Successful in 3m52s
Tests and linters / Lint (push) Successful in 4m30s
Tests and linters / Tests (push) Successful in 4m31s
OCI image / Build container images (push) Successful in 4m54s
Tests and linters / Tests with -race (push) Successful in 6m51s
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
Reference in a new issue