(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestWithMessageOptions_UseInjectedClock(t *testing.T) { |
| 104 | t.Parallel() |
| 105 | fixed := time.Date(2024, 3, 4, 5, 6, 7, 0, time.UTC) |
| 106 | want := fixed.Format(time.RFC3339) |
| 107 | |
| 108 | s := New( |
| 109 | WithClock(fixedClock(fixed)), |
| 110 | WithUserMessage("user"), |
| 111 | WithSystemMessage("system"), |
| 112 | WithImplicitUserMessage("implicit"), |
| 113 | ) |
| 114 | |
| 115 | if len(s.Messages) != 3 { |
| 116 | t.Fatalf("len(Messages) = %d, want 3", len(s.Messages)) |
| 117 | } |
| 118 | for i, item := range s.Messages { |
| 119 | if item.Message.Message.CreatedAt != want { |
| 120 | t.Errorf("Messages[%d].CreatedAt = %q, want %q", i, item.Message.Message.CreatedAt, want) |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func TestDuration_DeterministicWithExplicitTimestamps(t *testing.T) { |
| 126 | t.Parallel() |
nothing calls this directly
no test coverage detected