diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-13 10:44:57 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-13 10:45:41 -0400 |
| commit | 56523fc6a304c09f252449342b10c52f7836c4aa (patch) | |
| tree | 07cd85a92ba3c1393805a938fbc27b8ad18162b5 /lulu_test.go | |
| parent | 520f392ca5207f5364bbed501615613e3485b84b (diff) | |
| download | lulu-56523fc6a304c09f252449342b10c52f7836c4aa.zip | |
create print job
Diffstat (limited to 'lulu_test.go')
| -rw-r--r-- | lulu_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lulu_test.go b/lulu_test.go index 613cc4b..ceb0990 100644 --- a/lulu_test.go +++ b/lulu_test.go @@ -70,6 +70,22 @@ func requireUnmarshalJsonEq[T any](t *testing.T, expected T, j string) { require.Equal(t, expected, actual) } +// assert that t2 is after t1 +func requireAfter(t *testing.T, t2, t1 time.Time) { + t.Helper() + require.Truef(t, t2.After(t1), "%s not after %s", t2, t1) +} + +// assert that dt2 is not before tt1 +func requireNotBeforeDate(t *testing.T, dt2, dt1 Date) { + t.Helper() + y2, m2, d2 := time.Time(dt2).UTC().Date() + y1, m1, d1 := time.Time(dt1).UTC().Date() + require.Truef(t, y2 >= y1 && m2 >= m1 && d2 >= d1, "%s is before %s", + time.Date(y2, m2, d2, 0, 0, 0, 0, time.UTC).Format(time.DateOnly), + time.Date(y1, m1, d1, 0, 0, 0, 0, time.UTC).Format(time.DateOnly)) +} + // poll periodically calls f() until it returns true or the deadline is exceeded. func poll(t *testing.T, f func() bool) { t.Helper() |