Skip to content

Commit

Permalink
add cases for "1st", "2nd", "3rd", "4th"
Browse files Browse the repository at this point in the history
  • Loading branch information
ijt committed Jan 4, 2023
1 parent 0a43b7b commit 75dd831
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions v2/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,42 @@ func Test_parseImplicitRange(t *testing.T) {
wantR: truncateMonth(time.Date(2023, 10, 1, 0, 0, 0, 0, time.UTC)),
wantParsed: "oct",
},
{
name: "mar 1st",
args: args{
s: "mar 1st",
now: time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC),
},
wantR: truncateDay(time.Date(2023, 3, 1, 0, 0, 0, 0, time.UTC)),
wantParsed: "mar 1st",
},
{
name: "mar 2nd",
args: args{
s: "mar 2nd",
now: time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC),
},
wantR: truncateDay(time.Date(2023, 3, 2, 0, 0, 0, 0, time.UTC)),
wantParsed: "mar 2nd",
},
{
name: "mar 3rd",
args: args{
s: "mar 3rd",
now: time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC),
},
wantR: truncateDay(time.Date(2023, 3, 3, 0, 0, 0, 0, time.UTC)),
wantParsed: "mar 3rd",
},
{
name: "mar 4th",
args: args{
s: "mar 4th",
now: time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC),
},
wantR: truncateDay(time.Date(2023, 3, 4, 0, 0, 0, 0, time.UTC)),
wantParsed: "mar 4th",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 75dd831

Please sign in to comment.