Fix Sonar Part2

This commit is contained in:
Ming Deng
2021-02-01 18:45:57 +08:00
parent 2c9cd98d03
commit 9c392a3a09
14 changed files with 320 additions and 462 deletions

View File

@@ -21,14 +21,16 @@ import (
type baseQuerySetter struct {
}
const shouldNotInvoke = "you should not invoke this method."
func (b *baseQuerySetter) ForceIndex(indexes ...string) orm.QuerySeter {
panic("you should not invoke this method.")
panic(shouldNotInvoke)
}
func (b *baseQuerySetter) UseIndex(indexes ...string) orm.QuerySeter {
panic("you should not invoke this method.")
panic(shouldNotInvoke)
}
func (b *baseQuerySetter) IgnoreIndex(indexes ...string) orm.QuerySeter {
panic("you should not invoke this method.")
panic(shouldNotInvoke)
}

View File

@@ -16,6 +16,8 @@ package orm
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCamelString(t *testing.T) {
@@ -29,9 +31,7 @@ func TestCamelString(t *testing.T) {
for _, v := range snake {
res := camelString(v)
if res != answer[v] {
t.Error("Unit Test Fail:", v, res, answer[v])
}
assert.Equal(t, answer[v], res)
}
}
@@ -46,9 +46,7 @@ func TestSnakeString(t *testing.T) {
for _, v := range camel {
res := snakeString(v)
if res != answer[v] {
t.Error("Unit Test Fail:", v, res, answer[v])
}
assert.Equal(t, answer[v], res)
}
}
@@ -63,8 +61,6 @@ func TestSnakeStringWithAcronym(t *testing.T) {
for _, v := range camel {
res := snakeStringWithAcronym(v)
if res != answer[v] {
t.Error("Unit Test Fail:", v, res, answer[v])
}
assert.Equal(t, answer[v], res)
}
}