(t *testing.T)
| 59 | } |
| 60 | |
| 61 | func TestNewInvalidKeysError(t *testing.T) { |
| 62 | |
| 63 | tests := []struct { |
| 64 | name string |
| 65 | invalidKeys map[string]bool |
| 66 | wantErr bool |
| 67 | }{ |
| 68 | { |
| 69 | name: "No invalid keys", |
| 70 | invalidKeys: make(map[string]bool), |
| 71 | wantErr: false, |
| 72 | }, |
| 73 | { |
| 74 | name: "InvalidKeysError error", |
| 75 | invalidKeys: map[string]bool{ |
| 76 | "key1": true, |
| 77 | "key2": true, |
| 78 | }, |
| 79 | wantErr: true, |
| 80 | }, |
| 81 | } |
| 82 | for _, tt := range tests { |
| 83 | t.Run(tt.name, func(t *testing.T) { |
| 84 | err := newInvalidKeysError(tt.invalidKeys) |
| 85 | if tt.wantErr && err == nil { |
| 86 | t.Errorf("Expected error from test but got nil") |
| 87 | } else if !tt.wantErr && err != nil { |
| 88 | t.Errorf("Got unexpected error: %s", err) |
| 89 | } |
| 90 | }) |
| 91 | } |
| 92 | } |
nothing calls this directly
no test coverage detected