packages feed

shelltestrunner 1.2.1 → 1.3

raw patch · 2 files changed

+14/−43 lines, 2 filesdep ~Diffdep ~basedep ~cmdargs

Dependency ranges changed: Diff, base, cmdargs, test-framework, test-framework-hunit

Files

shelltest.hs view
@@ -1,5 +1,4 @@-#!/usr/bin/env runhaskell-{-# LANGUAGE DeriveDataTypeable, TemplateHaskell #-}+{-# LANGUAGE DeriveDataTypeable, TemplateHaskell, CPP #-} {- |  shelltest - a tool for testing command-line programs.@@ -12,11 +11,6 @@  module Main where--- encoding: we try to handle non-ascii content in test file paths, test--- commands, and expected test results.  For this we assume 1. ghc 6.12+--- and 2. that on unix, all file names/arguments/environment variables are--- utf8 encoded-import Codec.Binary.UTF8.String as UTF8 (decodeString, encodeString, isUTF8Encoded) import Control.Concurrent (forkIO) import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar) import Control.Monad (liftM,when,unless)@@ -25,7 +19,6 @@ import qualified Test.HUnit (Test) import System.Console.CmdArgs import System.Exit-import System.Info (os) import System.IO (Handle, hGetContents, hPutStr) import System.Process (StdStream (CreatePipe), shell, createProcess, CreateProcess (..), waitForProcess, ProcessHandle) import Test.Framework (defaultMainWithArgs)@@ -43,6 +36,8 @@ import Data.Algorithm.Diff import Distribution.PackageDescription.TH (packageVariable, package, pkgVersion) +import PlatformString (fromPlatformString, toPlatformString)+ strace :: Show a => a -> a strace a = trace (show a) a @@ -360,21 +355,21 @@       showm = if all_ then showMatcher else showMatcherTrimmed       trim' = if all_ then id else trim -showDiff :: Args -> (Int,Int) -> [(DI, String)] -> String+showDiff :: Args -> (Int,Int) -> [(Diff String)] -> String showDiff _ _ []                   = ""-showDiff args@Args{all_=all_,precise=precise} (l,r) ((F, ln) : ds) =+showDiff args@Args{all_=all_,precise=precise} (l,r) ((First ln) : ds) =     printf "+%4d " l ++ ln' ++ "\n" ++ showDiff args (l+1,r) ds     where       ln' = trim' $ show' ln       trim' = if all_ then id else trim       show' = if precise then show else id-showDiff args@Args{all_=all_,precise=precise} (l,r) ((S, ln) : ds) =+showDiff args@Args{all_=all_,precise=precise} (l,r) ((Second ln) : ds) =     printf "-%4d " r ++ ln' ++ "\n" ++ showDiff args (l,r+1) ds     where       ln' = trim' $ show' ln       trim' = if all_ then id else trim       show' = if precise then show else id-showDiff args (l,r) ((B, _ ) : ds) = showDiff args (l+1,r+1) ds+showDiff args (l,r) ((Both _ _) : ds) = showDiff args (l+1,r+1) ds  instance Show Matcher where show = showMatcherTrimmed @@ -447,28 +442,3 @@                           then new ++ replace' (drop len l)                           else h : replace' ts      len = length old---- | A platform string is a string value from or for the operating system,--- such as a file path or command-line argument (or environment variable's--- name or value ?). On some platforms (such as unix) these are not real--- unicode strings but have some encoding such as UTF-8. This alias does--- no type enforcement but aids code clarity.-type PlatformString = String---- | Convert a possibly encoded platform string to a real unicode string.--- We decode the UTF-8 encoding recommended for unix systems--- (cf http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html)--- and leave anything else unchanged.-fromPlatformString :: PlatformString -> String-fromPlatformString s = if UTF8.isUTF8Encoded s then UTF8.decodeString s else s---- | Convert a unicode string to a possibly encoded platform string.--- On unix we encode with the recommended UTF-8--- (cf http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html)--- and elsewhere we leave it unchanged.-toPlatformString :: String -> PlatformString-toPlatformString = case os of-                     "unix" -> UTF8.encodeString-                     "linux" -> UTF8.encodeString-                     "darwin" -> UTF8.encodeString-                     _ -> id
shelltestrunner.cabal view
@@ -1,6 +1,6 @@ name:           shelltestrunner -- sync with README.md, ANNOUNCE:-version:        1.2.1+version:        1.3 category:       Testing synopsis:       A tool for testing command-line programs. description:@@ -16,7 +16,7 @@ homepage:       http://joyful.com/shelltestrunner bug-reports:    mailto:simon@joyful.com stability:      stable-tested-with:    GHC==6.12.3, GHC==7.0.2, GHC==7.2.1, GHC==7.4.1+tested-with:    GHC==7.4.1, GHC==7.6.1 cabal-version:  >= 1.6 build-type:     Simple @@ -25,22 +25,23 @@  executable shelltest   main-is:        shelltest.hs+  other modules:  PlatformString   ghc-options:    -threaded -W -fwarn-tabs   build-depends:                  base                 >= 4     && < 5                 ,cabal-file-th                 ,filemanip            >= 0.3   && < 0.4                 ,HUnit                            < 1.3-                ,cmdargs              >= 0.7   && < 0.10+                ,cmdargs              >= 0.7   && < 0.11                 ,directory            >= 1.0                 ,filepath             >= 1.0                 ,parsec                           < 3.2                 ,regex-tdfa           >= 1.1   && < 1.2                 ,process                          < 1.2-                ,test-framework       >= 0.3.2 && < 0.6-                ,test-framework-hunit >= 0.2   && < 0.3+                ,test-framework       >= 0.3.2 && < 0.9+                ,test-framework-hunit >= 0.2   && < 0.4                 ,utf8-string          >= 0.3.5 && < 0.4-                ,Diff                 >= 0.1   && < 0.2+                ,Diff                 == 0.2.*  source-repository head   type:     darcs