On Thu, Jul 29, 2021 at 9:13 PM Carl <carle...@gmail.com> wrote: > Is there a way to write a unit test that simulates a change in the wall > clock for a time.Time value? >
Here is an example of how the Elvish shell stubs the time.After() function to verify its builtin "sleep" command behaves correctly without having to sleep for arbitrary intervals. It doesn't exactly do what you asked but illustrates one approach for doing such things. https://github.com/elves/elvish/blob/659bd5fa68d4b61a6c916f2cafca360c9e37482b/pkg/eval/builtin_fn_misc.go#L356-L364 https://github.com/elves/elvish/blob/659bd5fa68d4b61a6c916f2cafca360c9e37482b/pkg/eval/builtin_fn_misc_test.go#L100-L131 https://github.com/elves/elvish/blob/master/pkg/eval/builtin_fn_misc_unix_test.go -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_azHV9EjgTEw9cb2yck5Fye4ZX26MaCeb7hZGtp6mamw%40mail.gmail.com.