Skip to content

Instantly share code, notes, and snippets.

@vanstee
Last active September 30, 2021 01:28
Show Gist options
  • Save vanstee/5ed3e25246466420f42295456bf38678 to your computer and use it in GitHub Desktop.
Save vanstee/5ed3e25246466420f42295456bf38678 to your computer and use it in GitHub Desktop.
Run go tests with verbose flag in coderpad
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