diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-04-10 22:51:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-10 22:51:24 +0800 |
commit | e186a3d2c95aee3c652b010c2c08ed771590b86b (patch) | |
tree | 5b4f5637cef8a76cac979f2d225f540b141facea /internal/db/main_test.go | |
parent | 9a5b227f3ee2b2a3854d3aec022cc9a0cf0868b3 (diff) |
db: add tests for helper functions (#6084)
Diffstat (limited to 'internal/db/main_test.go')
-rw-r--r-- | internal/db/main_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/db/main_test.go b/internal/db/main_test.go new file mode 100644 index 00000000..24393f5b --- /dev/null +++ b/internal/db/main_test.go @@ -0,0 +1,30 @@ +// Copyright 2020 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package db + +import ( + "flag" + "fmt" + "os" + "testing" + + log "unknwon.dev/clog/v2" + + "gogs.io/gogs/internal/testutil" +) + +func TestMain(m *testing.M) { + flag.Parse() + if !testing.Verbose() { + // Remove the primary logger and register a noop logger. + log.Remove(log.DefaultConsoleName) + err := log.New("noop", testutil.InitNoopLogger) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + } + os.Exit(m.Run()) +} |