Skip to content

Commit

Permalink
mod: change date command tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolosLykos committed Sep 6, 2022
1 parent f5a44b3 commit 1165a0b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmd/date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,55 @@ var testCases = []struct {
{
name: "default",
args: nil,
expected: time.Now().Format("02 Jan 06") + "\n",
expected: "02 Jan 06",
err: false,
},
{
name: "02 01 06",
args: []string{"-f", "02 Jan 06"},
expected: time.Now().Format("02 Jan 06") + "\n",
expected: "02 Jan 06",
err: false,
},
{
name: "02 01 06 15:04:05",
args: []string{"-f", "02 01 06 15:04:05"},
expected: time.Now().Format("02 01 06 15:04:05") + "\n",
expected: "02 01 06 15:04:05",
err: false,
},
{
name: "02 Jan 06",
args: []string{"-f", "02 Jan 06"},
expected: time.Now().Format("02 Jan 06") + "\n",
expected: "02 Jan 06",
err: false,
},
{
name: "02 Jan 06 15:04:05",
args: []string{"-f", "02 Jan 06 15:04:05"},
expected: time.Now().Format("02 Jan 06 15:04:05") + "\n",
expected: "02 Jan 06 15:04:05",
err: false,
},
{
name: "Mon Jan 06",
args: []string{"-f", "Mon Jan 06"},
expected: time.Now().Format("Mon Jan 06") + "\n",
expected: "Mon Jan 06",
err: false,
},
{
name: "Mon Jan 06 15:04:05",
args: []string{"-f", "Mon Jan 06 15:04:05"},
expected: time.Now().Format("Mon Jan 06 15:04:05") + "\n",
expected: "Mon Jan 06 15:04:05",
err: false,
},
{
name: "02 01 2006",
args: []string{"-f", "02 01 2006"},
expected: time.Now().Format("02 01 2006") + "\n",
expected: "02 01 2006",
err: false,
},
{
name: "02 01 2006 15:04:05 MST",
args: []string{"-f", "02 01 2006 15:04:05 MST"},
expected: time.Now().Format("02 01 2006 15:04:05 MST") + "\n",
expected: "02 01 2006 15:04:05 MST",
err: false,
},
{
Expand All @@ -93,7 +93,7 @@ func TestDateCommand(t *testing.T) {
if tc.err {
assert.Error(t, err, tc.name)
} else {
assert.Equal(t, tc.expected, string(out), tc.name)
assert.Equal(t, time.Now().Format(tc.expected)+"\n", string(out), tc.name)
}
}
}

0 comments on commit 1165a0b

Please sign in to comment.