(t *testing.T)
| 140 | } |
| 141 | |
| 142 | func TestLint_RuleViolations(t *testing.T) { |
| 143 | linter := newDefaultLinter(t) |
| 144 | for _, tc := range ruleViolationCases { |
| 145 | t.Run(tc.name, func(t *testing.T) { |
| 146 | result, err := linter.ParseAndLint(tc.msg) |
| 147 | if err != nil { |
| 148 | t.Fatalf("unexpected error: %v", err) |
| 149 | } |
| 150 | found := false |
| 151 | for _, iss := range result.Issues() { |
| 152 | if iss.RuleName() == tc.wantRule { |
| 153 | found = true |
| 154 | break |
| 155 | } |
| 156 | } |
| 157 | if !found { |
| 158 | t.Errorf("expected rule %q in issues for %q", tc.wantRule, tc.msg) |
| 159 | for _, iss := range result.Issues() { |
| 160 | t.Logf(" got: [%s] %s: %s", iss.Severity(), iss.RuleName(), iss.Description()) |
| 161 | } |
| 162 | } |
| 163 | }) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | // --------------------------------------------------------------------------- |
| 168 | // Result preservation |
nothing calls this directly
no test coverage detected