author | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-04-06 12:58:18 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2025-04-06 13:04:53 UTC |
parent | 964a2a8f753d8f432b49cb4626ccfd1b9676d350 |
internal/aliases/aliases_test.go | +16 | -0 |
diff --git a/internal/aliases/aliases_test.go b/internal/aliases/aliases_test.go index 5d62aca..f8cf121 100644 --- a/internal/aliases/aliases_test.go +++ b/internal/aliases/aliases_test.go @@ -366,6 +366,22 @@ func TestRemoveDropsAndSuffix(t *testing.T) { {"a.bc+blah@def", "abc@def"}, {"x.yz@def", "xyz@def"}, {"x.yz@d.ef", "xyz@d.ef"}, + + // Cases with tricky mixes of suffix separators, to make sure we + // handle them correctly. + {"ab-xy@def", "ab@def"}, // Normal. + {"ab-+xy@def", "ab@def"}, // The two together, in different order. + {"ab+-xy@def", "ab@def"}, + {"ab-@def", "ab@def"}, // Ending in a separator. + {"ab+@def", "ab@def"}, + {"ab-+@def", "ab@def"}, + {"ab-xy-z@def", "ab@def"}, // Multiple in different places. + {"ab+xy-z@def", "ab@def"}, + {"ab-xy+z@def", "ab@def"}, + {"ab--xy@def", "ab@def"}, // Repeated separators. + {"ab++xy@def", "ab@def"}, + {"ab+-xy@def", "ab@def"}, + {"ab-+xy@def", "ab@def"}, } for _, c := range cases { addr := resolver.RemoveDropsAndSuffix(c.addr)