Skip to content

Commit

Permalink
Clean up tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Sep 5, 2024
1 parent 7d61746 commit c99c037
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/typing/ext/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ import (
)

func TestParseFromInterface(t *testing.T) {
var vals []any
vals = append(vals, NewExtendedTime(time.Now().UTC(), DateKindType, PostgresDateFormat))
vals = append(vals, NewExtendedTime(time.Now().UTC(), DateTimeKindType, ISO8601))
vals = append(vals, NewExtendedTime(time.Now().UTC(), TimeKindType, PostgresTimeFormat))
{
// Extended time
var vals []any
vals = append(vals, NewExtendedTime(time.Now().UTC(), DateKindType, PostgresDateFormat))
vals = append(vals, NewExtendedTime(time.Now().UTC(), DateTimeKindType, ISO8601))
vals = append(vals, NewExtendedTime(time.Now().UTC(), TimeKindType, PostgresTimeFormat))

for _, val := range vals {
extTime, err := ParseFromInterface(val, nil)
assert.NoError(t, err)
assert.Equal(t, val, extTime)
for _, val := range vals {
extTime, err := ParseFromInterface(val, nil)
assert.NoError(t, err)
assert.Equal(t, val, extTime)
}
}

{
// Nil
_, err := ParseFromInterface(nil, nil)
Expand Down

0 comments on commit c99c037

Please sign in to comment.