(t *testing.T)
| 162 | } |
| 163 | |
| 164 | func TestConfig_WriteCompactTo(t *testing.T) { |
| 165 | conf := config.NewDefault() |
| 166 | var buf bytes.Buffer |
| 167 | err := config.WriteCompactTo(&buf, conf) |
| 168 | if err != nil { |
| 169 | t.Fatalf("unexpected error: %v", err) |
| 170 | } |
| 171 | output := buf.String() |
| 172 | if output == "" { |
| 173 | t.Error("expected non-empty output from WriteCompactTo") |
| 174 | } |
| 175 | |
| 176 | // Should only contain settings for the 5 enabled rules, not all 20 |
| 177 | for _, disabled := range []string{"body-min-length", "body-max-length", "type-min-length", "scope-charset"} { |
| 178 | if bytes.Contains(buf.Bytes(), []byte(disabled+":")) { |
| 179 | t.Errorf("should not contain disabled rule setting %q", disabled) |
| 180 | } |
| 181 | } |
| 182 | for _, enabled := range []string{"header-min-length", "header-max-length", "type-enum"} { |
| 183 | if !bytes.Contains(buf.Bytes(), []byte(enabled+":")) { |
| 184 | t.Errorf("should contain enabled rule setting %q", enabled) |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | func TestConfig_WriteCompactTo_WithUserIgnores(t *testing.T) { |
| 190 | conf := config.NewDefault() |
nothing calls this directly
no test coverage detected