file-location 0.4.5.1 → 0.4.5.2
raw patch · 3 files changed
+45/−12 lines, 3 filesdep +processPVP ok
version bump matches the API change (PVP)
Dependencies added: process
API changes (from Hackage documentation)
Files
- file-location.cabal +2/−1
- test/file-location.shelltest +11/−11
- test/main.hs +32/−0
file-location.cabal view
@@ -1,5 +1,5 @@ Name: file-location-Version: 0.4.5.1+Version: 0.4.5.2 Synopsis: common functions that show file location information Homepage: https://github.com/gregwebs/FileLocation.hs License: BSD3@@ -86,6 +86,7 @@ , containers , template-haskell , transformers+ , process -- shelltestrunner: need shelltest executable Source-Repository head
test/file-location.shelltest view
@@ -1,24 +1,24 @@ -./test/main+./test/main foo >>> [1,2,3]-Caught AException "main:Main test/main.hs:25:4"-Caught AException "main:Main test/main.hs:26:6 doh!"-Caught main:Main test/main.hs:27:4 fromJst: Nothing-Caught main:Main test/main.hs:28:4 fromRht: Left: "Lefty"+Caught AException "main:Main test/main.hs:57:4"+Caught AException "main:Main test/main.hs:58:6 doh!"+Caught main:Main test/main.hs:59:4 fromJst: Nothing+Caught main:Main test/main.hs:60:4 fromRht: Left: "Lefty" Caught Prelude.undefined-("Rethrow",ReThrownException (main:Main test/main.hs:30:3): foo)+("Rethrow",ReThrownException (main:Main test/main.hs:62:3): foo) >>>2-TRACE: main:Main test/main.hs:22:84 trc+TRACE: main:Main test/main.hs:54:84 trc DEBUG: debugMsgIf: [1,2,3] DEBUG: [1,2,3]-DEBUG: main:Main test/main.hs:22:67: [1,2,3]+DEBUG: main:Main test/main.hs:54:67: [1,2,3] DEBUG: Msg plain: [1,2,3]-DEBUG: main:Main test/main.hs:22:23 Msg TH: [1,2,3]+DEBUG: main:Main test/main.hs:54:23 Msg TH: [1,2,3] traceM: [1,2,3] DEBUG: [1,2,3]-main:Main test/main.hs:29:3 undefined-main: main:Main test/main.hs:31:5 Oh no!+main:Main test/main.hs:61:3 undefined+test: main:Main test/main.hs:63:5 Oh no! >>>= 1 rm ./test/main ./test/main.hi ./test/main.o
test/main.hs view
@@ -5,7 +5,10 @@ import Control.Exception.Base (SomeException, Exception(..)) import Prelude hiding (catch) import Control.Exception.Lifted (catch)+import Control.Monad (unless) +import System.Environment (getArgs)+import System.Process (readProcessWithExitCode) @@ -17,6 +20,35 @@ main = do+ args <- getArgs+ case args of+ [] -> do+ (_, stdout, stderr) <- readProcessWithExitCode "dist/build/test/test" ["foo"] ""+ shelltest <- readFile "test/file-location.shelltest"+ let (stdout', stderr') = parseShellTest shelltest+ unless (unlines (lines stdout) == stdout') $ do+ putStrLn "Invalid stdout:"+ putStr stdout+ error "Failure"+ unless (unlines (lines stderr) == stderr') $ do+ putStrLn "Invalid stderr:"+ putStr stderr+ error "Failure"+ putStrLn "Success"+ _ -> main2+++parseShellTest :: String -> (String, String)+parseShellTest orig =+ (unlines stdout, unlines stderr)+ where+ ls1 = lines orig+ ls2 = drop 1 $ dropWhile (/= ">>>") ls1+ (stdout, ls3) = break (== ">>>2") ls2+ stderr = takeWhile (/= ">>>= 1") $ drop 1 ls3++main2 :: IO ()+main2 = do let _ = debugMsgIf "Not Visble" id False let x = debugMsgIf "debugMsgIf" (\xs -> head xs == 1) [1,2,3] putStrLn . show $ $(dbgMsg "Msg TH") $ debugMsg "Msg plain" $ $(dbg) $ debug $ $(trc "trc") x