(t *testing.T, file string, record bool)
| 250 | } |
| 251 | |
| 252 | func runLimitTest(t *testing.T, file string, record bool) { |
| 253 | var testCases []limitTestData |
| 254 | filepath := filepath.Join("test-data", file) |
| 255 | yamlFile, err := os.Open(filepath) |
| 256 | require.NoError(t, err) |
| 257 | defer yamlFile.Close() |
| 258 | |
| 259 | byteValue, err := io.ReadAll(yamlFile) |
| 260 | require.NoError(t, err) |
| 261 | err = yaml.Unmarshal(byteValue, &testCases) |
| 262 | require.NoError(t, err) |
| 263 | |
| 264 | for i, tc := range testCases { |
| 265 | want := addLimitFor12cAndLater(tc.Stmt, tc.Limit) |
| 266 | if record { |
| 267 | testCases[i].Want = want |
| 268 | } else { |
| 269 | require.Equal(t, tc.Want, want, tc.Stmt) |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | if record { |
| 274 | err := yamlFile.Close() |
| 275 | require.NoError(t, err) |
| 276 | yamltest.Record(t, filepath, testCases) |
| 277 | } |
| 278 | } |
no test coverage detected