Skip to content

Commit

Permalink
Merge pull request #64 from anisjonischkeit/patch-1
Browse files Browse the repository at this point in the history
Added *time.Time to Default arbitraries
  • Loading branch information
untoldwind authored Jan 24, 2020
2 parents aed0dd4 + 36affa8 commit f24d09d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arbitrary/arbitraries.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ type Arbitraries struct {
func DefaultArbitraries() *Arbitraries {
return &Arbitraries{
generators: map[reflect.Type]gopter.Gen{
reflect.TypeOf(time.Now()): gen.Time(),
reflect.TypeOf(time.Time{}): gen.Time(),
reflect.TypeOf(&time.Time{}): gen.Time().
Map(func(time time.Time) *time.Time { return &time }).
WithShrinker(func(v interface{}) gopter.Shrink {
t := v.(*time.Time)
return gen.TimeShrinker(*t)
}),
},
}
}
Expand Down

0 comments on commit f24d09d

Please sign in to comment.