(t *testing.T)
| 232 | } |
| 233 | |
| 234 | func TestLint_ParserErrorAlwaysError(t *testing.T) { |
| 235 | conf := config.NewDefault() |
| 236 | // Even with all rules set to warn, parser errors should be SeverityError |
| 237 | conf.Severity.Default = lint.SeverityWarn |
| 238 | rules, err := config.GetEnabledRules(conf) |
| 239 | if err != nil { |
| 240 | t.Fatal(err) |
| 241 | } |
| 242 | linter, err := lint.New(conf, rules) |
| 243 | if err != nil { |
| 244 | t.Fatal(err) |
| 245 | } |
| 246 | |
| 247 | result, err := linter.ParseAndLint("") |
| 248 | if err != nil { |
| 249 | t.Fatal(err) |
| 250 | } |
| 251 | if len(result.Issues()) == 0 { |
| 252 | t.Fatal("expected parser issue for empty msg") |
| 253 | } |
| 254 | for _, iss := range result.Issues() { |
| 255 | if iss.RuleName() == "parser" && iss.Severity() != lint.SeverityError { |
| 256 | t.Errorf("parser errors should be SeverityError, got %q", iss.Severity()) |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // --------------------------------------------------------------------------- |
| 262 | // Body edge cases |
nothing calls this directly
no test coverage detected