Last active
September 30, 2021 01:28
-
-
Save vanstee/5ed3e25246466420f42295456bf38678 to your computer and use it in GitHub Desktop.
Run go tests with verbose flag in coderpad
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
package main | |
import ( | |
"flag" | |
"testing" | |
) | |
func main() { | |
// register test flags | |
testing.Init() | |
// enable verbose mode | |
flag.Set("test.v", "true") | |
tests := []testing.InternalTest{ | |
{"TestOK", TestOK}, | |
{"TestError", TestError}, | |
} | |
// run the tests and print results | |
testing.Main(nil, tests, nil, nil) | |
} | |
func TestOK(t *testing.T) { | |
t.Logf("yep") | |
} | |
func TestError(t *testing.T) { | |
t.Fatalf("nope") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment