mirror of https://github.com/grpc/grpc-go.git
				
				
				
			Fix review comments
This commit is contained in:
		
							parent
							
								
									ffdfb592e8
								
							
						
					
					
						commit
						1b5902d709
					
				| 
						 | 
				
			
			@ -182,6 +182,18 @@ func TestContextErr(t *testing.T) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestErrorsWithSameParameters(t *testing.T) {
 | 
			
		||||
	const description = "some description"
 | 
			
		||||
	e1 := Errorf(codes.AlreadyExists, description)
 | 
			
		||||
	e2 := Errorf(codes.AlreadyExists, description)
 | 
			
		||||
	if e1 == e2 {
 | 
			
		||||
		t.Fatalf("Error interfaces should not be considered equal - e1: %p - %v  e2: %p - %v", e1, e1, e2, e2)
 | 
			
		||||
	}
 | 
			
		||||
	if Code(e1) != Code(e2) || ErrorDesc(e1) != ErrorDesc(e2) {
 | 
			
		||||
		t.Fatalf("Expected errors to have same code and description - e1: %p - %v  e2: %p - %v", e1, e1, e2, e2)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// bmEncode benchmarks encoding a Protocol Buffer message containing mSize
 | 
			
		||||
// bytes.
 | 
			
		||||
func bmEncode(b *testing.B, mSize int) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2129,23 +2129,5 @@ func (fw *filterWriter) Write(p []byte) (n int, err error) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func equalErrors(l, r error) bool {
 | 
			
		||||
	if l == nil && r != nil {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	if l != nil && r == nil {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	return grpc.Code(l) == grpc.Code(r) && grpc.ErrorDesc(l) == grpc.ErrorDesc(r)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestErrorsWithSameParameters(t *testing.T) {
 | 
			
		||||
	const description = "some description"
 | 
			
		||||
	e1 := grpc.Errorf(codes.AlreadyExists, description)
 | 
			
		||||
	e2 := grpc.Errorf(codes.AlreadyExists, description)
 | 
			
		||||
	if e1 == e2 {
 | 
			
		||||
		t.Fatalf("Error interfaces should not be considered equal - e1: %p - %v  e2: %p - %v", e1, e1, e2, e2)
 | 
			
		||||
	}
 | 
			
		||||
	if !equalErrors(e1, e2) {
 | 
			
		||||
		t.Fatalf("Expected errors to have same code and description - e1: %p - %v  e2: %p - %v", e1, e1, e2, e2)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue