Skip to content

Commit

Permalink
Fix issues report from testifylint (#267)
Browse files Browse the repository at this point in the history
This PR fixes issues report from
[testifylint](https://github.com/Antonboom/testifylint).
This PR contributes to #264.
  • Loading branch information
gouguoyin authored Dec 13, 2024
2 parents 2d8dc69 + d0e4228 commit 21ced83
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
42 changes: 21 additions & 21 deletions database_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,87 +427,87 @@ func TestError_Value(t *testing.T) {
c1 := Parse("")
v1, e1 := c1.Value()
require.NoError(t, e1)
assert.Equal(t, v1, nil)
assert.Nil(t, v1)

c2 := NewDateTime(c1)
v2, e2 := c2.Value()
require.NoError(t, e2)
assert.Equal(t, v2, nil)
assert.Nil(t, v2)

c3 := NewDateTimeMilli(c1)
v3, e3 := c3.Value()
require.NoError(t, e3)
assert.Equal(t, v3, nil)
assert.Nil(t, v3)

c4 := NewDateTimeMicro(c1)
v4, e4 := c4.Value()
require.NoError(t, e4)
assert.Equal(t, v4, nil)
assert.Nil(t, v4)

c5 := NewDateTimeNano(c1)
v5, e5 := c5.Value()
require.NoError(t, e5)
assert.Equal(t, v5, nil)
assert.Nil(t, v5)

c6 := NewDate(c1)
v6, e6 := c6.Value()
require.NoError(t, e6)
assert.Equal(t, v6, nil)
assert.Nil(t, v6)

c7 := NewDateMilli(c1)
v7, e7 := c7.Value()
require.NoError(t, e7)
assert.Equal(t, v7, nil)
assert.Nil(t, v7)

c8 := NewDateMicro(c1)
v8, e8 := c8.Value()
require.NoError(t, e8)
assert.Equal(t, v8, nil)
assert.Nil(t, v8)

c9 := NewDateNano(c1)
v9, e9 := c9.Value()
require.NoError(t, e9)
assert.Equal(t, v9, nil)
assert.Nil(t, v9)

c10 := NewTime(c1)
v10, e10 := c10.Value()
require.NoError(t, e10)
assert.Equal(t, v10, nil)
assert.Nil(t, v10)

c11 := NewTimeMilli(c1)
v11, e11 := c11.Value()
require.NoError(t, e11)
assert.Equal(t, v11, nil)
assert.Nil(t, v11)

c12 := NewTimeMicro(c1)
v12, e12 := c12.Value()
require.NoError(t, e12)
assert.Equal(t, v12, nil)
assert.Nil(t, v12)

c13 := NewTimeNano(c1)
v13, e13 := c13.Value()
require.NoError(t, e13)
assert.Equal(t, v13, nil)
assert.Nil(t, v13)

c14 := NewTimestamp(c1)
v14, e14 := c14.Value()
require.NoError(t, e14)
assert.Equal(t, v14, nil)
assert.Nil(t, v14)

c15 := NewTimestampMilli(c1)
v15, e15 := c15.Value()
require.NoError(t, e15)
assert.Equal(t, v15, nil)
assert.Nil(t, v15)

c16 := NewTimestampMicro(c1)
v16, e16 := c16.Value()
require.NoError(t, e16)
assert.Equal(t, v16, nil)
assert.Nil(t, v16)

c17 := NewTimestampNano(c1)
v17, e17 := c17.Value()
require.NoError(t, e17)
assert.Equal(t, v17, nil)
assert.Nil(t, v17)
}

type Person struct {
Expand Down Expand Up @@ -907,10 +907,10 @@ func TestCarbon_Issue240(t *testing.T) {
require.NoError(t, emptyErr)
assert.Equal(t, "0001-01-01 00:00:00 +0000 UTC", person.Birthday1.StdTime().String())
assert.Equal(t, "0001-01-01 00:00:00 +0000 UTC", person.Birthday2.StdTime().String())
assert.Equal(t, true, person.Birthday1.IsZero())
assert.Equal(t, true, person.Birthday2.IsZero())
assert.Equal(t, false, person.Birthday1.IsValid())
assert.Equal(t, false, person.Birthday2.IsValid())
assert.True(t, person.Birthday1.IsZero())
assert.True(t, person.Birthday2.IsZero())
assert.False(t, person.Birthday1.IsValid())
assert.False(t, person.Birthday2.IsValid())
}

// https://github.com/dromara/carbon/issues/243
Expand Down
4 changes: 2 additions & 2 deletions language_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func TestLanguage_SetResources1(t *testing.T) {
for index, test := range tests {
c1 := c.Parse(test.input1)
c2 := c.Parse(test.input2)
assert.Nil(c1.Error)
assert.Nil(c2.Error)
assert.NoError(c1.Error)
assert.NoError(c2.Error)
assert.Equal(test.expected, c1.DiffForHumans(c2), "Current test index is "+strconv.Itoa(index))
}
}
Expand Down
8 changes: 4 additions & 4 deletions parser_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ func TestCarbon_ParseByLayout(t *testing.T) {
}

func TestError_ParseByLayout(t *testing.T) {
assert.NotNil(t, ParseByLayout("2020-08-05", "2006-03-04", "xxx").Error, "It should catch an exception in ParseByLayout")
assert.NotNil(t, ParseByLayout("xxx", "2006-03-04", PRC).Error, "It should catch an exception in ParseByLayout")
assert.Error(t, ParseByLayout("2020-08-05", "2006-03-04", "xxx").Error, "It should catch an exception in ParseByLayout")
assert.Error(t, ParseByLayout("xxx", "2006-03-04", PRC).Error, "It should catch an exception in ParseByLayout")
}

func TestError_ParseByFormat(t *testing.T) {
assert.NotNil(t, ParseByFormat("2020-08-05", "Y-m-d", "xxx").Error, "It should catch an exception in ParseByFormat()")
assert.NotNil(t, ParseByFormat("xxx", "Y-m-d", PRC).Error, "It should catch an exception in ParseByFormat")
assert.Error(t, ParseByFormat("2020-08-05", "Y-m-d", "xxx").Error, "It should catch an exception in ParseByFormat()")
assert.Error(t, ParseByFormat("xxx", "Y-m-d", PRC).Error, "It should catch an exception in ParseByFormat")
}

// https://github.com/dromara/carbon/issues/202
Expand Down

0 comments on commit 21ced83

Please sign in to comment.