| 22 | } |
| 23 | |
| 24 | func (b *Stub) Verify(t _testing, url string) { |
| 25 | t.Helper() |
| 26 | if url != "" { |
| 27 | switch len(b.urls) { |
| 28 | case 0: |
| 29 | t.Errorf("expected browser to open URL %q, but it was never invoked", url) |
| 30 | case 1: |
| 31 | if url != b.urls[0] { |
| 32 | t.Errorf("expected browser to open URL %q, got %q", url, b.urls[0]) |
| 33 | } |
| 34 | default: |
| 35 | t.Errorf("expected browser to open one URL, but was invoked %d times", len(b.urls)) |
| 36 | } |
| 37 | } else if len(b.urls) > 0 { |
| 38 | t.Errorf("expected no browser to open, but was invoked %d times: %v", len(b.urls), b.urls) |
| 39 | } |
| 40 | } |