summaryrefslogtreecommitdiffstats
path: root/models/unittest/bridge.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-11-16 16:53:21 +0800
committerGitHub <noreply@github.com>2021-11-16 16:53:21 +0800
commit81926d61db3dac223a75ea49eab893b25a089587 (patch)
tree627d2f19a008089f3a688e9a94a2cc8d2017afe2 /models/unittest/bridge.go
parent23bd7b1211a80aa3b0dcb60ec4a1c0089ff28dd4 (diff)
downloadgitea-81926d61db3dac223a75ea49eab893b25a089587.tar.gz
gitea-81926d61db3dac223a75ea49eab893b25a089587.zip
Decouple unit test, remove intermediate `unittestbridge` package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/unittest/bridge.go')
-rw-r--r--models/unittest/bridge.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/models/unittest/bridge.go b/models/unittest/bridge.go
deleted file mode 100644
index 776dd69519..0000000000
--- a/models/unittest/bridge.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2021 The Gitea 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 unittest
-
-import (
- "code.gitea.io/gitea/modules/unittestbridge"
- "github.com/stretchr/testify/assert"
-)
-
-// For legacy code only, please refer to the `unittestbridge` package.
-
-// TestifyAsserter uses "stretchr/testify/assert" to do assert
-type TestifyAsserter struct {
- t unittestbridge.Tester
-}
-
-// Errorf assert Errorf
-func (ta TestifyAsserter) Errorf(format string, args ...interface{}) {
- ta.t.Errorf(format, args)
-}
-
-// NoError assert NoError
-func (ta TestifyAsserter) NoError(err error, msgAndArgs ...interface{}) bool {
- return assert.NoError(ta, err, msgAndArgs...)
-}
-
-// EqualValues assert EqualValues
-func (ta TestifyAsserter) EqualValues(expected, actual interface{}, msgAndArgs ...interface{}) bool {
- return assert.EqualValues(ta, expected, actual, msgAndArgs...)
-}
-
-// Equal assert Equal
-func (ta TestifyAsserter) Equal(expected, actual interface{}, msgAndArgs ...interface{}) bool {
- return assert.Equal(ta, expected, actual, msgAndArgs...)
-}
-
-// True assert True
-func (ta TestifyAsserter) True(value bool, msgAndArgs ...interface{}) bool {
- return assert.True(ta, value, msgAndArgs...)
-}
-
-// False assert False
-func (ta TestifyAsserter) False(value bool, msgAndArgs ...interface{}) bool {
- return assert.False(ta, value, msgAndArgs...)
-}
-
-// InitUnitTestBridge init the unit test bridge. eg: models.CheckConsistencyFor can use testing and assert frameworks
-func InitUnitTestBridge() {
- unittestbridge.SetNewAsserterFunc(func(t unittestbridge.Tester) unittestbridge.Asserter {
- return &TestifyAsserter{t: t}
- })
-}