summaryrefslogtreecommitdiff
path: root/libraries/base/tests
diff options
context:
space:
mode:
authorHécate <hecate+gitlab@glitchbra.in>2020-09-18 20:07:49 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-23 20:44:24 -0400
commit31fea307499009977fdf3dadedc98cfef986077a (patch)
treecac7edf234b82d16c3edd53fc38539fcc2766cb5 /libraries/base/tests
parenta997fa01d907fc1992dc8c3ebc73f98e7a1486f7 (diff)
downloadhaskell-31fea307499009977fdf3dadedc98cfef986077a.tar.gz
Remove redundant "do", "return" and language extensions from base
Diffstat (limited to 'libraries/base/tests')
-rw-r--r--libraries/base/tests/Concurrent/MVar001.hs2
-rw-r--r--libraries/base/tests/IO/encoding001.hs2
-rw-r--r--libraries/base/tests/IO/encoding004.hs4
-rw-r--r--libraries/base/tests/IO/hClose002.hs2
-rw-r--r--libraries/base/tests/IO/hClose003.hs2
-rw-r--r--libraries/base/tests/IO/hDuplicateTo001.hs2
-rw-r--r--libraries/base/tests/IO/hReady002.hs4
-rw-r--r--libraries/base/tests/IO/newline001.hs2
-rw-r--r--libraries/base/tests/IO/readwrite002.hs1
-rw-r--r--libraries/base/tests/T13167.hs2
-rw-r--r--libraries/base/tests/T13896.hs12
-rw-r--r--libraries/base/tests/T9532.hs4
-rw-r--r--libraries/base/tests/foldableArray.hs1
-rw-r--r--libraries/base/tests/qsem001.hs6
-rw-r--r--libraries/base/tests/qsemn001.hs6
15 files changed, 25 insertions, 27 deletions
diff --git a/libraries/base/tests/Concurrent/MVar001.hs b/libraries/base/tests/Concurrent/MVar001.hs
index 6062cbfa46..0d96a7eb27 100644
--- a/libraries/base/tests/Concurrent/MVar001.hs
+++ b/libraries/base/tests/Concurrent/MVar001.hs
@@ -78,7 +78,7 @@ perform' mv (a:as) =
actions :: Gen [Action]
-actions = do
+actions =
oneof [liftM (NewEmptyMVar:) (actions' True),
liftM2 (:) (liftM NewMVar arbitrary) (actions' False)]
diff --git a/libraries/base/tests/IO/encoding001.hs b/libraries/base/tests/IO/encoding001.hs
index c92f8a3ef5..df3c5f914c 100644
--- a/libraries/base/tests/IO/encoding001.hs
+++ b/libraries/base/tests/IO/encoding001.hs
@@ -33,7 +33,7 @@ main = do
hClose h
-- convert the UTF-32BE file into each other encoding
- forM_ encodings $ \(enc,name) -> do
+ forM_ encodings $ \(enc,name) ->
when (name /= "utf32be") $ do
hin <- openFile (file <.> "utf32be") ReadMode
hSetEncoding hin utf32be
diff --git a/libraries/base/tests/IO/encoding004.hs b/libraries/base/tests/IO/encoding004.hs
index 62ef5d6a93..ffd76191f3 100644
--- a/libraries/base/tests/IO/encoding004.hs
+++ b/libraries/base/tests/IO/encoding004.hs
@@ -58,8 +58,8 @@ main = forM_ [ ("CP936", 2, "CP936", Just "CP936-UTF8") -- Representative
utf8_bs <- BS.readFile ("encoded-data" </> utf8_file <.> "txt")
Right expected <- decode utf8 utf8_bs
Right actual <- decode enc bs
- unless (expected == actual) $ do
- putStrLn (bsDiff 0 actual expected)
+ unless (expected == actual) $
+ putStrLn (bsDiff 0 actual expected)
forTruncations :: BS.ByteString -> (BS.ByteString -> IO a) -> IO [a]
forTruncations bs f = forSplits bs $ \before _ -> f before
diff --git a/libraries/base/tests/IO/hClose002.hs b/libraries/base/tests/IO/hClose002.hs
index ebf26b4663..20eb0f888a 100644
--- a/libraries/base/tests/IO/hClose002.hs
+++ b/libraries/base/tests/IO/hClose002.hs
@@ -27,6 +27,6 @@ showPossibleException f = do e <- try f
print (e :: Either SomeException ())
naughtyClose h =
- withHandle_ "naughtyClose" h $ \ Handle__{haDevice=dev} -> do
+ withHandle_ "naughtyClose" h $ \ Handle__{haDevice=dev} ->
IODevice.close dev
diff --git a/libraries/base/tests/IO/hClose003.hs b/libraries/base/tests/IO/hClose003.hs
index cbaf49d6db..6d962fd94e 100644
--- a/libraries/base/tests/IO/hClose003.hs
+++ b/libraries/base/tests/IO/hClose003.hs
@@ -38,5 +38,5 @@ showPossibleException f = do
sanitise' (x:xs) = if isDigit x then (sanitise' xs) else (x:(sanitise xs))
naughtyClose h =
- withHandle_ "naughtyClose" h $ \ Handle__{haDevice=dev} -> do
+ withHandle_ "naughtyClose" h $ \ Handle__{haDevice=dev} ->
IODevice.close dev
diff --git a/libraries/base/tests/IO/hDuplicateTo001.hs b/libraries/base/tests/IO/hDuplicateTo001.hs
index 99f956a0df..e286235e14 100644
--- a/libraries/base/tests/IO/hDuplicateTo001.hs
+++ b/libraries/base/tests/IO/hDuplicateTo001.hs
@@ -18,7 +18,7 @@ main = do
putStrLn "bla"
-getfd h@(FileHandle _ mvar) = do
+getfd h@(FileHandle _ mvar) =
withMVar mvar $ \h__@Handle__{haDevice=dev} ->
case cast dev of
Just fd -> return (FD.fdFD fd)
diff --git a/libraries/base/tests/IO/hReady002.hs b/libraries/base/tests/IO/hReady002.hs
index b8b648065b..b13ef8911e 100644
--- a/libraries/base/tests/IO/hReady002.hs
+++ b/libraries/base/tests/IO/hReady002.hs
@@ -5,6 +5,6 @@ import System.Exit
main = do
m <- newEmptyMVar
- forkIO $ do threadDelay 500000; putMVar m Nothing
- forkIO $ do hReady stdin >>= putMVar m . Just
+ forkIO $ threadDelay 500000 >> putMVar m Nothing
+ forkIO $ hReady stdin >>= putMVar m . Just
takeMVar m >>= print
diff --git a/libraries/base/tests/IO/newline001.hs b/libraries/base/tests/IO/newline001.hs
index 3da867509f..1c894422a9 100644
--- a/libraries/base/tests/IO/newline001.hs
+++ b/libraries/base/tests/IO/newline001.hs
@@ -101,7 +101,7 @@ testoutput b = do
check "out2" b (toCRLF content) str
hClose h
-check s b str1 str2 = do
+check s b str1 str2 =
when (str1 /= str2) $ error ("failed: " ++ s ++ ", " ++ show b ++ '\n':show str1 ++ '\n':show str2)
read_chars :: Handle -> IO String
diff --git a/libraries/base/tests/IO/readwrite002.hs b/libraries/base/tests/IO/readwrite002.hs
index 37c7da39cb..5795525b2c 100644
--- a/libraries/base/tests/IO/readwrite002.hs
+++ b/libraries/base/tests/IO/readwrite002.hs
@@ -29,7 +29,6 @@ main = do
hSeek cd AbsoluteSeek 0
hSetBuffering cd LineBuffering
speak cd `catchIOError` \ err -> if isEOFError err then putStrLn "\nCaught EOF" else ioError err
- return ()
hSeek cd AbsoluteSeek 0
hSetBuffering cd (BlockBuffering Nothing)
speak cd `catchIOError` \ err -> if isEOFError err then putStrLn "\nCaught EOF" else ioError err
diff --git a/libraries/base/tests/T13167.hs b/libraries/base/tests/T13167.hs
index e41104cde9..d8808667b1 100644
--- a/libraries/base/tests/T13167.hs
+++ b/libraries/base/tests/T13167.hs
@@ -25,5 +25,5 @@ run = do
quit :: MVar () -> IO ()
quit m = do
ref <- newIORef ()
- void $ mkWeakIORef ref $ do
+ void $ mkWeakIORef ref $
putMVar m ()
diff --git a/libraries/base/tests/T13896.hs b/libraries/base/tests/T13896.hs
index 9e269a4a7c..8b4c47f44a 100644
--- a/libraries/base/tests/T13896.hs
+++ b/libraries/base/tests/T13896.hs
@@ -65,11 +65,11 @@ main = do
-- without escaping everything inside
(filter (not . null) $
- unescapeArgs "this\\ is\\ 'not escape\\d \"inside\"'\\ yo\n")
- `assertEqual`
- ["this is not escaped \"inside\" yo"]
+ unescapeArgs "this\\ is\\ 'not escape\\d \"inside\"'\\ yo\n")
+ `assertEqual`
+ ["this is not escaped \"inside\" yo"]
(filter (not . null) $
- unescapeArgs "this\\ is\\ \"not escape\\d 'inside'\"\\ yo\n")
- `assertEqual`
- ["this is not escaped 'inside' yo"]
+ unescapeArgs "this\\ is\\ \"not escape\\d 'inside'\"\\ yo\n")
+ `assertEqual`
+ ["this is not escaped 'inside' yo"]
diff --git a/libraries/base/tests/T9532.hs b/libraries/base/tests/T9532.hs
index e99a42b572..b9f280fcf8 100644
--- a/libraries/base/tests/T9532.hs
+++ b/libraries/base/tests/T9532.hs
@@ -68,7 +68,7 @@ main = do
-- Compare impl-under-test with reference-impl
checkCLZ :: (Typeable a, Show a, Integral a, FiniteBits a) => a -> IO ()
- checkCLZ v = unless (vri == viut) $ do
+ checkCLZ v = unless (vri == viut) $
putStrLn $ concat [ "FAILED: clz (0x", showHex v " :: ", tyName
, ") ==> (RI=", show vri, " vs. IUT=", show viut, ")"
]
@@ -79,7 +79,7 @@ main = do
-- Compare impl-under-test with reference-impl
checkCTZ :: (Typeable a, Show a, Integral a, FiniteBits a) => a -> IO ()
- checkCTZ v = unless (vri == viut) $ do
+ checkCTZ v = unless (vri == viut) $
putStrLn $ concat [ "FAILED: ctz (0x", showHex v " :: ", tyName
, ") ==> (RI=", show vri, " vs. IUT=", show viut, ")"
]
diff --git a/libraries/base/tests/foldableArray.hs b/libraries/base/tests/foldableArray.hs
index 92217d73d2..5caf4eeb76 100644
--- a/libraries/base/tests/foldableArray.hs
+++ b/libraries/base/tests/foldableArray.hs
@@ -6,7 +6,6 @@ module Main where
import Prelude hiding (foldr, foldl, foldl', foldr1, foldl1, length, null, sum,
product, all, any, and, or)
-import Data.Foldable
import Control.Exception
import Data.Array
import Data.Foldable
diff --git a/libraries/base/tests/qsem001.hs b/libraries/base/tests/qsem001.hs
index 0088c6e989..4254c2b9fc 100644
--- a/libraries/base/tests/qsem001.hs
+++ b/libraries/base/tests/qsem001.hs
@@ -68,7 +68,7 @@ sem_fifo = do
sem_kill :: Assertion
sem_kill = do
q <- new 0
- t <- forkIO $ do wait q
+ t <- forkIO $ wait q
threadDelay 100000
killThread t
m <- newEmptyMVar
@@ -80,8 +80,8 @@ sem_kill = do
sem_bracket :: Assertion
sem_bracket = do
q <- new 1
- ts <- forM [1..100000] $ \n -> do
- forkIO $ do bracket_ (wait q) (signal q) (return ())
+ ts <- forM [1..100000] $ \n ->
+ forkIO $ bracket_ (wait q) (signal q) (return ())
mapM_ killThread ts
wait q
diff --git a/libraries/base/tests/qsemn001.hs b/libraries/base/tests/qsemn001.hs
index c61d2896c2..3f76f376aa 100644
--- a/libraries/base/tests/qsemn001.hs
+++ b/libraries/base/tests/qsemn001.hs
@@ -92,7 +92,7 @@ semn3 = do
semn_kill :: Assertion
semn_kill = do
q <- new 0
- t <- forkIO $ do wait q 1
+ t <- forkIO $ wait q 1
threadDelay 10000
killThread t
m <- newEmptyMVar
@@ -103,7 +103,7 @@ semn_kill = do
sem_bracket :: Assertion
sem_bracket = do
q <- new 1
- ts <- forM [1..100000] $ \n -> do
- forkIO $ do bracket_ (wait q 1) (signal q 1) (return ())
+ ts <- forM [1..100000] $ \n ->
+ forkIO $ bracket_ (wait q 1) (signal q 1) (return ())
mapM_ killThread ts
wait q 1