Skip to content

Commit

Permalink
add test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
esilva-everbridge committed May 31, 2018
1 parent 43ecf0b commit ce59b34
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions generate-secure-pillar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,13 @@ func scanString(buffer string, wantedCount int, term string) error {
}

// Assert fails the test if the provided condition is false
func Assert(tb testing.TB, condition bool, msg string, v ...interface{}) {
if !condition {
_, file, line, _ := runtime.Caller(1)
fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
tb.FailNow()
}
}
// func Assert(tb testing.TB, condition bool, msg string, v ...interface{}) {
// if !condition {
// _, file, line, _ := runtime.Caller(1)
// fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
// tb.FailNow()
// }
// }

// Ok fails the test if the `err` is not nil
func Ok(tb testing.TB, err error) {
Expand Down

0 comments on commit ce59b34

Please sign in to comment.