[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/libemailfunctions/tests
From:       Matt Douhan <matt () fruitsalad ! org>
Date:       2005-01-01 18:16:57
Message-ID: 20050101181657.4588C1CD09 () office ! kde ! org
[Download RAW message or body]

CVS commit by mdouhan: 

Testframework updated for the new simple check method


  M +23 -0     testemail.cpp   1.7


--- kdepim/libemailfunctions/tests/testemail.cpp  #1.6:1.7
@@ -79,4 +79,13 @@ static QString emailTestParseResultToStr
 }
 
+static QString simpleEmailTestParseResultToString( bool validEmail )
+{
+  if ( validEmail ) {
+    return "true"; 
+  } else if ( !validEmail ) {
+    return "false";
+  }
+}
+
 static bool checkIsValidEmailAddress( const QString& input, const QString&  expErrorCode )
 {
@@ -87,4 +96,12 @@ static bool checkIsValidEmailAddress( co
 }
 
+static bool checkIsValidSimpleEmailAddress( const QString& input, const QString& expResult )
+{
+  bool validEmail = KPIM::isValidSimpleEmailAddress( input );
+  QString result = simpleEmailTestParseResultToString( validEmail );
+  check( "isValidSimpleEmailAddress " + input + " result ", result, expResult );
+  return true;
+}
+
 int main(int argc, char *argv[])
 {
@@ -204,4 +221,10 @@ int main(int argc, char *argv[])
   checkIsValidEmailAddress( "\"Douhan, Matt\" <matt@fruitsalad.org>", "AddressOk" );
 
+  // checks for "pure" email addresses in the form of xxx@yyy.tld
+  checkIsValidSimpleEmailAddress( "matt@fruitsalad.org", "true" );
+
+  // check if the pure email address is wrong
+  checkIsValidSimpleEmailAddress( "mattfruitsalad.org", "false" );
+
   printf("\nTest OK !\n");
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic