fix sonar problem

* replace min limit value with const values
* remove duplicated testcase and add testcase
* put together switch case statement
* fill empty block of code
This commit is contained in:
t29kida
2021-05-29 23:48:17 +09:00
parent 2f174db197
commit de65d82701
4 changed files with 23 additions and 25 deletions

View File

@@ -1845,17 +1845,12 @@ func TestRawQueryRow(t *testing.T) {
case "id":
throwFail(t, AssertIs(id, 1))
break
case "time":
case "time", "datetime":
v = v.(time.Time).In(DefaultTimeLoc)
value := dataValues[col].(time.Time).In(DefaultTimeLoc)
assert.True(t, v.(time.Time).Sub(value) <= time.Second)
break
case "date":
case "datetime":
v = v.(time.Time).In(DefaultTimeLoc)
value := dataValues[col].(time.Time).In(DefaultTimeLoc)
assert.True(t, v.(time.Time).Sub(value) <= time.Second)
break
default:
throwFail(t, AssertIs(v, dataValues[col]))
}
@@ -2769,6 +2764,7 @@ func TestStrPkInsert(t *testing.T) {
fmt.Println(err)
if err.Error() == "postgres version must 9.5 or higher" || err.Error() == "`sqlite3` nonsupport InsertOrUpdate in beego" {
} else if err == ErrLastInsertIdUnavailable {
return
} else {
throwFailNow(t, err)
}