Skip to content

Commit

Permalink
tweak a test to get 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ijt committed Jan 8, 2023
1 parent ac9bd09 commit 39a2115
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions v2/replace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestReplaceAllRangesByFunc_lastYearReplacements(t *testing.T) {
now := time.UnixMilli(rand.Int63())
ly := lastYear(now)
f := func(src string, r Range) string {
return fmt.Sprintf("%v", r.Start().UnixMilli())
return fmt.Sprintf("%v - %v", r.Start().UnixMilli(), r.End().UnixMilli())
}
inputs := []string{
"last year",
Expand All @@ -118,7 +118,7 @@ func TestReplaceAllRangesByFunc_lastYearReplacements(t *testing.T) {
for _, input := range inputs {
t.Run(input, func(t *testing.T) {
got := ReplaceAllRangesByFunc(input, now, Past, f)
want := strings.ReplaceAll(input, "last year", fmt.Sprintf("%v", ly.Start().UnixMilli()))
want := strings.ReplaceAll(input, "last year", fmt.Sprintf("%v - %v", ly.Start().UnixMilli(), ly.End().UnixMilli()))
if got != want {
t.Errorf("got = %v, want %v", got, want)
}
Expand Down

0 comments on commit 39a2115

Please sign in to comment.