Skip to content

Commit

Permalink
✅ chore: all - fix some unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 4, 2023
1 parent b6942a2 commit 18aa036
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions cliutil/termctrl/opchars.go
@@ -0,0 +1,9 @@
package termctrl

// some op chars
// \x0D - Move the cursor to the beginning of the line
// \x1B[2K - Erase(Delete) the line
const (
GotoLineStart = "\x0D"
EraseLine = "\x1B[2K"
)
2 changes: 1 addition & 1 deletion fsutil/finder/finder_test.go
Expand Up @@ -148,6 +148,6 @@ func TestFileFinder_ExcludeName(t *testing.T) {

names := f.FindNames()
fmt.Println(names)
assert.Contains(t, names, "filter.go")
assert.Contains(t, names, "matcher.go")
assert.NotContains(t, names, "elem.go")
}
8 changes: 4 additions & 4 deletions timex/util_test.go
Expand Up @@ -49,7 +49,7 @@ func TestDateFormat(t *testing.T) {
{"2006-01-02 15:04", "Y-m-d H:I"},
{"01/02 15:04:05", "m/d H:I:S"},
{"06/01/02 15:04:05", "y/m/d H:I:S"},
{"06/01/02 15:04:05.000", "y/m/d H:I:Sv"},
{"06/01/02 15:04:05.000", "y/m/d H:I:S.v"},
}

for i, item := range tests {
Expand All @@ -60,7 +60,7 @@ func TestDateFormat(t *testing.T) {
}
}

assert.Eq(t, now.Format("01/02 15:04:05.000000"), timex.Date(now, "m/d H:I:Su"))
assert.Eq(t, now.Format("01/02 15:04:05.000000"), timex.Date(now, "m/d H:I:S.u"))
}

func TestFormatUnix(t *testing.T) {
Expand Down Expand Up @@ -114,8 +114,8 @@ func TestToDur(t *testing.T) {
assert.Eq(t, item.out, dur)
}

dur, err := timex.ToDur("now")
assert.NoErr(t, err)
dur, err := timex.ToDur("invalid")
assert.Err(t, err)
assert.Eq(t, time.Duration(0), dur)

dur, err = timex.ToDuration("0")
Expand Down

0 comments on commit 18aa036

Please sign in to comment.