(t *testing.T)
| 165 | } |
| 166 | |
| 167 | func TestRender_TestFunction_WithOptions(t *testing.T) { |
| 168 | tests := []struct { |
| 169 | name string |
| 170 | printInputs bool |
| 171 | subtests bool |
| 172 | named bool |
| 173 | parallel bool |
| 174 | useGoCmp bool |
| 175 | checkContent string |
| 176 | }{ |
| 177 | { |
| 178 | name: "with subtests", |
| 179 | subtests: true, |
| 180 | checkContent: "t.Run", |
| 181 | }, |
| 182 | { |
| 183 | name: "with parallel", |
| 184 | subtests: true, |
| 185 | parallel: true, |
| 186 | checkContent: "t.Parallel", |
| 187 | }, |
| 188 | } |
| 189 | |
| 190 | for _, tt := range tests { |
| 191 | t.Run(tt.name, func(t *testing.T) { |
| 192 | r := New() |
| 193 | buf := &bytes.Buffer{} |
| 194 | |
| 195 | fn := &models.Function{ |
| 196 | Name: "TestFunc", |
| 197 | IsExported: true, |
| 198 | Parameters: []*models.Field{ |
| 199 | {Name: "x", Type: &models.Expression{Value: "int"}}, |
| 200 | }, |
| 201 | Results: []*models.Field{ |
| 202 | {Type: &models.Expression{Value: "int"}}, |
| 203 | }, |
| 204 | } |
| 205 | |
| 206 | err := r.TestFunction(buf, fn, tt.printInputs, tt.subtests, tt.named, tt.parallel, tt.useGoCmp, nil, nil) |
| 207 | if err != nil { |
| 208 | t.Errorf("Render.TestFunction() error = %v", err) |
| 209 | } |
| 210 | |
| 211 | if tt.checkContent != "" && !bytes.Contains(buf.Bytes(), []byte(tt.checkContent)) { |
| 212 | t.Errorf("Render.TestFunction() output does not contain %q", tt.checkContent) |
| 213 | } |
| 214 | }) |
| 215 | } |
| 216 | } |
nothing calls this directly
no test coverage detected