1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-27 16:17:03 +00:00

aliases: Add more tests for multiple suffix separators

This patch adds more tests for situations involving multiple suffix
separators.
This commit is contained in:
Alberto Bertogli
2025-04-06 13:58:18 +01:00
parent 964a2a8f75
commit 9524d307eb

View File

@@ -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)