Further improvements on JID parsing

This commit is contained in:
Mickael Remond
2019-06-07 11:40:10 +02:00
parent 3ccc2680b0
commit b8fdc510a6
2 changed files with 35 additions and 14 deletions
+4
View File
@@ -14,6 +14,7 @@ func TestValidJids(t *testing.T) {
// resource can contain '/' or '@'
{jidstr: "test@domain.com/a/b", expected: Jid{"test", "domain.com", "a/b"}},
{jidstr: "test@domain.com/a@b", expected: Jid{"test", "domain.com", "a@b"}},
{jidstr: "domain.com", expected: Jid{"", "domain.com", ""}},
}
for _, tt := range tests {
@@ -43,6 +44,9 @@ func TestValidJids(t *testing.T) {
func TestIncorrectJids(t *testing.T) {
badJids := []string{
"",
"user@",
"@domain.com",
"user:name@domain.com",
"user<name@domain.com",
"test@domain.com@otherdomain.com",