-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the ability to Append a zero valued time.Time (#1228)
* Bump ch-go to v0.61.5 * Adds the ability to Append a zero valued time.Time
- Loading branch information
1 parent
45dbc8f
commit 7e2272c
Showing
8 changed files
with
94 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package column | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestDateOverflow(t *testing.T) { | ||
t.Parallel() | ||
zeroTime := time.Time{} | ||
tests := []struct { | ||
v time.Time | ||
name string | ||
err bool | ||
}{ | ||
{ | ||
name: "valid date", | ||
v: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), | ||
err: false, | ||
}, | ||
{ | ||
name: "before min date", | ||
v: minDate.Add(-time.Second), | ||
err: true, | ||
}, | ||
{ | ||
name: "after max date", | ||
v: maxDate.Add(time.Second), | ||
err: true, | ||
}, | ||
{ | ||
name: "zero value date", | ||
v: zeroTime, | ||
err: false, | ||
}, | ||
{ | ||
name: "non-zero value equal to zero date", | ||
v: time.UnixMilli(zeroTime.UnixMilli()), | ||
err: false, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
test := test | ||
t.Run(test.name, func(t *testing.T) { | ||
t.Parallel() | ||
err := dateOverflow(minDateTime, maxDateTime, test.v, defaultDateFormatNoZone) | ||
if (err != nil) != test.err { | ||
t.Errorf("expected error: %v, got: %v", test.err, err) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters