pipe_test.go 470 B

123456789101112131415161718192021222324
  1. // Copyright 2014 The Go Authors.
  2. // See https://code.google.com/p/go/source/browse/CONTRIBUTORS
  3. // Licensed under the same terms as Go itself:
  4. // https://code.google.com/p/go/source/browse/LICENSE
  5. package http2
  6. import (
  7. "errors"
  8. "testing"
  9. )
  10. func TestPipeClose(t *testing.T) {
  11. var p pipe
  12. p.c.L = &p.m
  13. a := errors.New("a")
  14. b := errors.New("b")
  15. p.Close(a)
  16. p.Close(b)
  17. _, err := p.Read(make([]byte, 1))
  18. if err != a {
  19. t.Errorf("err = %v want %v", err, a)
  20. }
  21. }