packages feed

hsimport 0.2.6.5 → 0.2.6.6

raw patch · 3 files changed

+16/−18 lines, 3 filesdep +hsimportdep −processdep ~tasty

Dependencies added: hsimport

Dependencies removed: process

Dependency ranges changed: tasty

Files

hsimport.cabal view
@@ -1,12 +1,12 @@ Name:          hsimport-Version:       0.2.6.5+Version:       0.2.6.6 License:       BSD3 License-file:  LICENSE Author:        Daniel Trstenjak Maintainer:    daniel.trstenjak@gmail.com Build-Type:    Simple Category:      Utils-Cabal-Version: >=1.6+Cabal-Version: >=1.8 Synopsis:      A command line program for extending the import list of a Haskell source file. Description:   A command line program for extending the import list of a Haskell source file. @@ -57,11 +57,12 @@                  attoparsec >= 0.10.4.0 && < 0.11,                  directory >= 1.2.0.1 && < 1.3 -Executable hsimport-tests+test-suite hsimport-tests   Main-is:       tests/Main.hs   ghc-options:   -W+  type:          exitcode-stdio-1.0   Build-Depends: base >= 3 && < 5,-                 tasty >= 0.6 && < 0.7,+                 tasty >= 0.6 && < 0.8,                  tasty-golden >= 2.2.0.1 && < 2.3,                  filepath >= 1.3.0.1 && < 1.4,-                 process >= 1.1.0.2 && < 1.2+                 hsimport
src/HsImport/Args.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DeriveDataTypeable, CPP #-} -module HsImport.Args +module HsImport.Args    ( HsImportArgs(..)    , hsImportArgs    ) where@@ -12,7 +12,7 @@ import Paths_hsimport (version) #endif -data HsImportArgs = HsImportArgs +data HsImportArgs = HsImportArgs    { moduleName    :: String    , symbolName    :: String    , qualifiedName :: String
tests/Main.hs view
@@ -3,9 +3,10 @@  import Test.Tasty import Test.Tasty.Golden-import System.Process import System.FilePath-import Data.List (intercalate)+import System.IO (hPutStrLn, stderr)+import HsImport (hsImport, hsImportSpec)+import qualified HsImport.Args as Args  main = defaultMain tests @@ -73,17 +74,13 @@    goldenVsFileDiff testName diff goldenFile outputFile command    where       command = do-        handle <- runCommand $ "hsimport " ++ params-        waitForProcess handle-        return ()+         let args = Args.HsImportArgs moduleName symbolName qualifiedName inputFile outputFile+         spec <- hsImportSpec args+         case spec of+              Left error  -> hPutStrLn stderr ("hsimport: " ++ error)+              Right spec_ -> hsImport spec_        diff ref new = ["diff", "-u", ref, new]--      params      = intercalate " " [moduleParam, symbolParam, qualParam, outputParam, inputFile]-      moduleParam = "-m '" ++ moduleName ++ "'"-      symbolParam = if null symbolName then "" else "-s '" ++ symbolName ++ "'"-      qualParam   = if null qualifiedName then "" else "-q '" ++ qualifiedName ++ "'"-      outputParam = "-o '" ++ outputFile ++ "'"        goldenFile = "tests" </> "goldenFiles" </> testName <.> "hs"       outputFile = "tests" </> "outputFiles" </> testName <.> "hs"