From fde07f22f2fc8161e4c867352bd00ca611a2786c Mon Sep 17 00:00:00 2001 From: Andreas Zwinkau Date: Fri, 21 Jun 2013 11:04:41 +0200 Subject: [PATCH] Unittesting uriLength and emailLength Previously untested. Pushes code coverage from 57% to 79%. --- std/uri.d | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/std/uri.d b/std/uri.d index 772a7992f..39eec2bed 100644 --- a/std/uri.d +++ b/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 {