|
@@ -27,3 +27,32 @@ func BenchmarkGenerateBatchID(b *testing.B) {
|
27
|
27
|
session.generateBatchID()
|
28
|
28
|
}
|
29
|
29
|
}
|
|
30
|
+
|
|
31
|
+func TestUserMasks(t *testing.T) {
|
|
32
|
+ var um UserMaskSet
|
|
33
|
+
|
|
34
|
+ if um.Match("horse_!user@tor-network.onion") {
|
|
35
|
+ t.Error("bad match")
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+ um.Add("_!*@*", "x", "x")
|
|
39
|
+ if !um.Match("_!user@tor-network.onion") {
|
|
40
|
+ t.Error("failure to match")
|
|
41
|
+ }
|
|
42
|
+ if um.Match("horse_!user@tor-network.onion") {
|
|
43
|
+ t.Error("bad match")
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ um.Add("beer*!*@*", "x", "x")
|
|
47
|
+ if !um.Match("beergarden!user@tor-network.onion") {
|
|
48
|
+ t.Error("failure to match")
|
|
49
|
+ }
|
|
50
|
+ if um.Match("horse_!user@tor-network.onion") {
|
|
51
|
+ t.Error("bad match")
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ um.Add("horse*!user@*", "x", "x")
|
|
55
|
+ if !um.Match("horse_!user@tor-network.onion") {
|
|
56
|
+ t.Error("failure to match")
|
|
57
|
+ }
|
|
58
|
+}
|