summaryrefslogtreecommitdiffhomepage
path: root/Tests.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-27 20:22:53 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-27 20:24:31 -0400
commit758965d177d75f529bb88e24564a0bdb5e406fc6 (patch)
tree8632125811610fb7444784d10caf6441dcf792e7 /Tests.hs
parent40ef6d76d4d50c48f103c2b94cd45c7647a25dbc (diff)
downloadkeysafe-758965d177d75f529bb88e24564a0bdb5e406fc6.tar.gz
Filter out escape sequences and any other unusual characters when writing all messages to the console.
This should protect against all attacks where the server sends back a malicious message.
Diffstat (limited to 'Tests.hs')
-rw-r--r--Tests.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/Tests.hs b/Tests.hs
index 1b9bd0e..7955c7f 100644
--- a/Tests.hs
+++ b/Tests.hs
@@ -8,6 +8,7 @@
module Tests where
import Types
+import Output
import Tunables
import Encryption
import Share
@@ -16,7 +17,6 @@ import Storage.Local
import Control.Exception
import System.Directory
import System.Posix.Temp
-import System.IO
import qualified Data.ByteString.UTF8 as BU8
import qualified Data.ByteString as B
import qualified Data.Set as S
@@ -36,22 +36,21 @@ testFailed = return . Left
runTest :: Test -> IO Bool
runTest (d, t) = do
- putStr $ "testing: " ++ show d ++ " ..."
- hFlush stdout
+ progress $ "testing: " ++ show d ++ " ..."
r <- t
case r of
Right () -> do
- putStrLn "ok"
+ say "ok"
return True
Left e -> do
- putStrLn $ "failed: " ++ show e
+ say $ "failed: " ++ show e
return False
runTests :: IO ()
runTests = do
r <- mapM runTest tests
if all (== True) r
- then putStrLn "All tests succeeded."
+ then say "All tests succeeded."
else error "Tests failed. Report a bug!"
tests :: [Test]