mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
Unittesting uriLength and emailLength
Previously untested. Pushes code coverage from 57% to 79%.
This commit is contained in:
parent
fdbf4f32c1
commit
fde07f22f2
1 changed files with 17 additions and 0 deletions
17
std/uri.d
17
std/uri.d
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue