─── V-MAF-005: alias key validation ─────────────────────────────────────────
(t *testing.T)
| 252 | // ─── V-MAF-005: alias key validation ───────────────────────────────────────── |
| 253 | |
| 254 | func TestValidateAliasKey(t *testing.T) { |
| 255 | tests := []struct { |
| 256 | key string |
| 257 | wantErr bool |
| 258 | }{ |
| 259 | {"sonnet", false}, |
| 260 | {"my-alias", false}, |
| 261 | {"", false}, // empty string = default policy, always allowed |
| 262 | {"a/b", true}, // V-MAF-005: slash |
| 263 | {"a?b", true}, // V-MAF-005: question mark |
| 264 | {"a&b", true}, // V-MAF-005: ampersand |
| 265 | } |
| 266 | for _, tt := range tests { |
| 267 | t.Run(tt.key, func(t *testing.T) { |
| 268 | err := validateAliasKey(tt.key, "/fake/path.md") |
| 269 | if tt.wantErr { |
| 270 | require.Error(t, err, "alias key %q should fail validation (V-MAF-005)", tt.key) |
| 271 | assert.Contains(t, err.Error(), "V-MAF-005", "error should reference V-MAF-005") |
| 272 | } else { |
| 273 | assert.NoError(t, err, "alias key %q should pass validation", tt.key) |
| 274 | } |
| 275 | }) |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | // ─── V-MAF-010: circular alias detection ───────────────────────────────────── |
| 280 |
nothing calls this directly
no test coverage detected