| 84 | } |
| 85 | |
| 86 | func (s) TestFromNilProto(t *testing.T) { |
| 87 | tests := []*Status{nil, FromProto(nil)} |
| 88 | for _, s := range tests { |
| 89 | if c := s.Code(); c != codes.OK { |
| 90 | t.Errorf("s: %v - Expected s.Code() = OK; got %v", s, c) |
| 91 | } |
| 92 | if m := s.Message(); m != "" { |
| 93 | t.Errorf("s: %v - Expected s.Message() = \"\"; got %q", s, m) |
| 94 | } |
| 95 | if p := s.Proto(); p != nil { |
| 96 | t.Errorf("s: %v - Expected s.Proto() = nil; got %q", s, p) |
| 97 | } |
| 98 | if e := s.Err(); e != nil { |
| 99 | t.Errorf("s: %v - Expected s.Err() = nil; got %v", s, e) |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func (s) TestError(t *testing.T) { |
| 105 | err := Error(codes.Internal, "test description") |