Created
June 7, 2014 19:32
-
-
Save collinvandyck/d267d9caabc97db71045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helper methods for testing | |
package test | |
import ( | |
"fmt" | |
"path/filepath" | |
"runtime" | |
"testing" | |
) | |
func Assert(t *testing.T, condition bool, explanation interface{}) { | |
if !condition { | |
if _, file, line, ok := runtime.Caller(1); ok { | |
short := filepath.Base(file) | |
t.Fatal(fmt.Sprintf("%s:%d: %s", short, line, explanation)) | |
} | |
t.Fatal(explanation) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment