THRIFT-847 Test Framework harmonization across all languages

Signed-off-by: Roger Meier <roger@apache.org>
diff --git a/test/hs/TestClient.hs b/test/hs/TestClient.hs
index 35e8397..2b9254b 100644
--- a/test/hs/TestClient.hs
+++ b/test/hs/TestClient.hs
@@ -23,6 +23,7 @@
 import Control.Exception
 import Control.Monad
 import Data.Functor
+import Data.List.Split
 import Data.String
 import Network
 import System.Environment
@@ -80,10 +81,10 @@
 runClient p = do
   let prot = (p,p)
   putStrLn "Starting Tests"
-              
+
   -- VOID Test
   Client.testVoid prot
-  
+
   -- String Test
   s <- Client.testString prot "Test"
   when (s /= "Test") exitFailure
@@ -91,11 +92,11 @@
   -- Byte Test
   byte <- Client.testByte prot 1
   when (byte /= 1) exitFailure
-  
+
   -- I32 Test
   i32 <- Client.testI32 prot (-1)
   when (i32 /= -1) exitFailure
-  
+
   -- I64 Test
   i64 <- Client.testI64 prot (-34359738368)
   when (i64 /= -34359738368) exitFailure
@@ -110,7 +111,7 @@
                        , xtruct_i32_thing    = -3
                        , xtruct_i64_thing    = -5
                        }
-  structOut <- Client.testStruct prot structIn 
+  structOut <- Client.testStruct prot structIn
   when (structIn /= structOut) exitFailure
 
   -- Nested Struct Test
@@ -120,22 +121,22 @@
                       }
   nestOut <- Client.testNest prot nestIn
   when (nestIn /= nestOut) exitSuccess
-  
+
   -- Map Test
   let mapIn = Map.fromList $ map (\i -> (i, i-10)) [1..5]
   mapOut <- Client.testMap prot mapIn
   when (mapIn /= mapOut) exitSuccess
-  
+
   -- Set Test
   let setIn = Set.fromList [-2..3]
   setOut <- Client.testSet prot setIn
   when (setIn /= setOut) exitFailure
-  
+
   -- List Test
   let listIn = Vector.fromList [-2..3]
   listOut <- Client.testList prot listIn
   when (listIn /= listOut) exitFailure
-  
+
   -- Enum Test
   numz1 <- Client.testEnum prot ONE
   when (numz1 /= ONE) exitFailure
@@ -149,26 +150,26 @@
   -- Typedef Test
   uid <- Client.testTypedef prot 309858235082523
   when (uid /= 309858235082523) exitFailure
-  
+
   -- Nested Map Test
   _ <- Client.testMapMap prot 1
-  
+
   -- Exception Test
   exn1 <- try $ Client.testException prot "Xception"
   case exn1 of
     Left (Xception _ _) -> return ()
     _ -> putStrLn (show exn1) >> exitFailure
-  
+
   exn2 <- try $ Client.testException prot "TException"
   case exn2 of
     Left (_ :: SomeException) -> return ()
     Right _ -> exitFailure
-  
+
   exn3 <- try $ Client.testException prot "success"
   case exn3 of
     Left (_ :: SomeException) -> exitFailure
     Right _ -> return ()
-  
+
   -- Multi Exception Test
   multi1 <- try $ Client.testMultiException prot "Xception" "test 1"
   case multi1 of
@@ -197,24 +198,24 @@
             Binary  -> runClient $ BinaryProtocol handle
             Compact -> runClient $ CompactProtocol handle
             JSON    -> runClient $ JSONProtocol handle
-      replicateM_ testLoops client      
+      replicateM_ testLoops client
       putStrLn "COMPLETED SUCCESSFULLY"
 
 parseFlags :: [String] -> Options -> Maybe Options
+parseFlags (flag : flags) opts = do
+  let pieces = splitOn "=" flag
+  case pieces of
+    "--port" : arg : _ -> parseFlags flags opts{ port = read arg }
+    "--domain-socket" : arg : _ -> parseFlags flags opts{ domainSocket = read arg }
+    "--host" : arg : _ -> parseFlags flags opts{ host = arg }
+    "--transport" : arg : _ -> parseFlags flags opts{ transport = arg }
+    "--protocol" : arg : _ -> parseFlags flags opts{ protocol = getProtocol arg }
+    "--h" : _ -> Nothing
+    "--help" : _ -> Nothing
+    "--ssl" : _ -> parseFlags flags opts{ ssl = True }
+    "--processor-events" : _ -> parseFlags flags opts
 parseFlags (flag : arg : flags) opts
-  | flag == "--port"          = parseFlags flags opts{ port = read arg }
-  | flag == "--domain-socket" = parseFlags flags opts{ domainSocket = arg }
-  | flag == "--host"          = parseFlags flags opts{ host = arg }
-  | flag == "--transport"     = parseFlags flags opts{ transport = arg }
-  | flag == "--protocol"      = parseFlags flags opts{ protocol = getProtocol arg }
-  | flag == "-n" ||
-    flag == "--testloops"     = parseFlags flags opts{ testLoops = read arg }
-parseFlags (flag : flags) opts
-  | flag == "-h"     = Nothing
-  | flag == "--help" = Nothing
-  | flag == "--ssl"  = parseFlags flags opts{ ssl = True }
-  | flag == "--processor-events" ||
-    otherwise = parseFlags flags opts
+  | flag == "-n"                    = parseFlags flags opts{ testLoops = read arg }
 parseFlags [] opts = Just opts
 
 showHelp :: IO ()
@@ -223,7 +224,7 @@
   \  -h [ --help ]               produce help message\n\
   \  --host arg (=localhost)     Host to connect\n\
   \  --port arg (=9090)          Port number to connect\n\
-  \  --domain-socket arg         Domain Socket (e.g. /tmp/ThriftTest.thrift),\n\ 
+  \  --domain-socket arg         Domain Socket (e.g. /tmp/ThriftTest.thrift),\n\
   \                              instead of host and port\n\
   \  --transport arg (=buffered) Transport: buffered, framed, http, evhttp\n\
   \  --protocol arg (=binary)    Protocol: binary, compact, json\n\