golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/http2/errors_test.go (about)

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