MCPcopy
hub / github.com/uber-go/nilaway / TestGroupErrorMessages

Function TestGroupErrorMessages

nilaway_test.go:161–183  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

159}
160
161func 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
185func TestExcludeTestFiles(t *testing.T) { //nolint:paralleltest
186 // We specifically do not set this test to be parallel such that this test is run separately

Callers

nothing calls this directly

Calls 4

StringMethod · 0.65
LookupMethod · 0.65
RunMethod · 0.65
NoErrorMethod · 0.45

Tested by

no test coverage detected