(t *testing.T)
| 78 | } |
| 79 | |
| 80 | func TestWantConn_tryDeliver_WithError(t *testing.T) { |
| 81 | w := &wantConn{ |
| 82 | ctx: context.Background(), |
| 83 | result: make(chan wantConnResult, 1), |
| 84 | } |
| 85 | |
| 86 | testErr := errors.New("test error") |
| 87 | |
| 88 | // Test delivery with error |
| 89 | delivered := w.tryDeliver(nil, testErr) |
| 90 | if !delivered { |
| 91 | t.Error("tryDeliver() = false, want true") |
| 92 | } |
| 93 | |
| 94 | // Check result |
| 95 | select { |
| 96 | case result := <-w.result: |
| 97 | if result.cn != nil { |
| 98 | t.Errorf("result.cn = %v, want nil", result.cn) |
| 99 | } |
| 100 | if result.err != testErr { |
| 101 | t.Errorf("result.err = %v, want %v", result.err, testErr) |
| 102 | } |
| 103 | case <-time.After(time.Millisecond): |
| 104 | t.Error("Expected result to be sent to channel") |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | func TestWantConn_tryDeliver_AlreadyDone(t *testing.T) { |
| 109 | w := &wantConn{ |
nothing calls this directly
no test coverage detected