github.com/cloudwego/kitex@v0.9.0/pkg/remote/trans/nphttp2/grpc/grpcframe/errors_test.go (about) 1 /* 2 * Copyright 2014 The Go Authors. All rights reserved. 3 * Use of this source code is governed by a BSD-style 4 * license that can be found in the LICENSE file. 5 * 6 * Code forked from golang v1.17.4 7 */ 8 9 package grpcframe 10 11 import ( 12 "testing" 13 14 "golang.org/x/net/http2" 15 ) 16 17 func TestErrCodeString(t *testing.T) { 18 tests := []struct { 19 err http2.ErrCode 20 want string 21 }{ 22 {http2.ErrCodeProtocol, "PROTOCOL_ERROR"}, 23 {0xd, "HTTP_1_1_REQUIRED"}, 24 {0xf, "unknown error code 0xf"}, 25 } 26 for i, tt := range tests { 27 got := tt.err.String() 28 if got != tt.want { 29 t.Errorf("%d. Error = %q; want %q", i, got, tt.want) 30 } 31 } 32 }