(t *testing.T)
| 790 | } |
| 791 | |
| 792 | func TestContextInvalid(t *testing.T) { |
| 793 | s := RunDefaultServer() |
| 794 | defer s.Shutdown() |
| 795 | |
| 796 | nc := NewDefaultConnection(t) |
| 797 | defer nc.Close() |
| 798 | |
| 799 | //lint:ignore SA1012 testing that passing nil fails |
| 800 | _, err := nc.RequestWithContext(nil, "foo", []byte("")) |
| 801 | if err == nil { |
| 802 | t.Fatal("Expected request to fail with error") |
| 803 | } |
| 804 | if err != nats.ErrInvalidContext { |
| 805 | t.Errorf("Expected request to fail with connection closed error: %s", err) |
| 806 | } |
| 807 | |
| 808 | sub, err := nc.Subscribe("foo", func(_ *nats.Msg) {}) |
| 809 | if err != nil { |
| 810 | t.Fatalf("Expected to be able to subscribe: %s", err) |
| 811 | } |
| 812 | |
| 813 | //lint:ignore SA1012 testing that passing nil fails |
| 814 | _, err = sub.NextMsgWithContext(nil) |
| 815 | if err == nil { |
| 816 | t.Fatal("Expected request to fail with error") |
| 817 | } |
| 818 | if err != nats.ErrInvalidContext { |
| 819 | t.Errorf("Expected request to fail with connection closed error: %s", err) |
| 820 | } |
| 821 | } |
nothing calls this directly
no test coverage detected