| 62 | } |
| 63 | |
| 64 | func TestEqual(t *testing.T) { |
| 65 | test := func(in1, in2 string, wantEq bool) { |
| 66 | eq := Equal(in1, in2) |
| 67 | if eq != wantEq { |
| 68 | t.Errorf("Want Equal(%s, %s) == %v, got %v", in1, in2, wantEq, eq) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | test("test@example.org", "test@example.org", true) |
| 73 | test("test2@example.org", "test@example.org", false) |
| 74 | test("TEST2@example.org", "TesT2@example.org", true) |
| 75 | test("E\u0301@example.org", "\u00E9@example.org", true) |
| 76 | test("test@тест.example.org", "test@xn--e1aybc.example.org", true) |
| 77 | test("test@xn--999999999999999.example.org", "test@xn--999999999999999.example.org", true) |
| 78 | test("test@xn--999999999999.example.org", "test@xn--999999999999999.example.org", false) |
| 79 | } |
| 80 | |
| 81 | func TestIsASCII(t *testing.T) { |
| 82 | if !IsASCII("hello") { |