Unittesting uriLength and emailLength

Previously untested. Pushes code coverage from 57% to 79%.
This commit is contained in:
Andreas Zwinkau 2013-06-21 11:04:41 +02:00
parent fdbf4f32c1
commit fde07f22f2

View file

@ -431,6 +431,15 @@ Lno:
return -1;
}
unittest
{
string s1 = "http://www.digitalmars.com/~fred/fredsRX.html#foo end!";
assert (uriLength(s1) == 49);
string s2 = "no uri here";
assert (uriLength(s2) == -1);
}
/***************************
* Does string s[] start with an email address?
* Returns:
@ -487,6 +496,14 @@ Lno:
return -1;
}
unittest
{
string s1 = "my.e-mail@www.example-domain.com with garbage added";
assert (emailLength(s1) == 32);
string s2 = "no email address here";
assert (emailLength(s2) == -1);
}
unittest
{