rice

personal dot files and scripts for linux and macOS
Log | Files | Refs | README | LICENSE

testmain (234B)


      1 # -*- mode: snippet -*-
      2 # name: testmain
      3 # key: testmain
      4 # contributor : @atotto
      5 # --
      6 func TestMain(m *testing.M) {
      7 	setup()
      8 	ret := m.Run()
      9 	if ret == 0 {
     10 		teardown()
     11 	}
     12 	os.Exit(ret)
     13 }
     14 
     15 func setup() {
     16 	$1
     17 }
     18 
     19 func teardown() {
     20 	$2
     21 }