errors_test.go 533 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 "testing"
  6. func TestErrCodeString(t *testing.T) {
  7. tests := []struct {
  8. err ErrCode
  9. want string
  10. }{
  11. {ErrCodeProtocol, "PROTOCOL_ERROR"},
  12. {0xd, "HTTP_1_1_REQUIRED"},
  13. {0xf, "unknown error code 0xf"},
  14. }
  15. for i, tt := range tests {
  16. got := tt.err.String()
  17. if got != tt.want {
  18. t.Errorf("%d. Error = %q; want %q", i, got, tt.want)
  19. }
  20. }
  21. }