pipe_test.go 469 B

123456789101112131415161718192021222324
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package http2
  5. import (
  6. "bytes"
  7. "errors"
  8. "testing"
  9. )
  10. func TestPipeClose(t *testing.T) {
  11. var p pipe
  12. p.b = new(bytes.Buffer)
  13. a := errors.New("a")
  14. b := errors.New("b")
  15. p.CloseWithError(a)
  16. p.CloseWithError(b)
  17. _, err := p.Read(make([]byte, 1))
  18. if err != a {
  19. t.Errorf("err = %v want %v", err, a)
  20. }
  21. }