| 159 | } |
| 160 | |
| 161 | func TestGroupErrorMessages(t *testing.T) { //nolint:paralleltest |
| 162 | // We specifically do not set this test to be parallel such that this test is run separately |
| 163 | // from the parallel tests. This makes it possible to test the group error messages flag independently |
| 164 | // without affecting the other tests. |
| 165 | testdata := analysistest.TestData() |
| 166 | |
| 167 | defaultValue := config.Analyzer.Flags.Lookup(config.GroupErrorMessagesFlag).Value.String() |
| 168 | |
| 169 | err := config.Analyzer.Flags.Set(config.GroupErrorMessagesFlag, "true") |
| 170 | require.NoError(t, err) |
| 171 | analysistest.Run(t, testdata, Analyzer, "grouping/enabled") |
| 172 | analysistest.Run(t, testdata, Analyzer, "grouping/errormessage", "grouping/errormessage/inference") |
| 173 | |
| 174 | err = config.Analyzer.Flags.Set(config.GroupErrorMessagesFlag, "false") |
| 175 | require.NoError(t, err) |
| 176 | analysistest.Run(t, testdata, Analyzer, "grouping/disabled") |
| 177 | |
| 178 | // Reset the flag to its default value. |
| 179 | defer func() { |
| 180 | err := config.Analyzer.Flags.Set(config.GroupErrorMessagesFlag, defaultValue) |
| 181 | require.NoError(t, err) |
| 182 | }() |
| 183 | } |
| 184 | |
| 185 | func TestExcludeTestFiles(t *testing.T) { //nolint:paralleltest |
| 186 | // We specifically do not set this test to be parallel such that this test is run separately |