Some minor fixups for compilation

This commit is contained in:
John Wiegley 2018-04-07 15:13:58 -07:00
parent deb592b11d
commit c8e9012778
3 changed files with 17 additions and 20 deletions

View File

@ -2,7 +2,7 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: 429fc2370bb078161c283b1238eb797ca1c03c46e4c1a2f68ac80937a901bb79
-- hash: 2a22f1191905e2b66f2d356247a272e923144902c5ad6026fe72d137f8127a77
name: hnix
version: 0.5.0
@ -135,6 +135,7 @@ test-suite hnix-tests
NixLanguageTests
ParserTests
PrettyTests
TestCommon
Paths_hnix
hs-source-dirs:
tests

View File

@ -23,7 +23,6 @@ import Nix.Utils
import Nix.Stack
import Nix.Value
import Nix.XML
import System.Directory
import System.Environment
import System.FilePath
import System.FilePath.Glob (compile, globDir1)
@ -128,7 +127,7 @@ assertEval files = catch go $ \case
assertEvalFail :: FilePath -> Assertion
assertEvalFail file = catch ?? (\(_ :: SomeException) -> return ()) $ do
evalResult <- printNix <$> nixEvalFile file
evalResult <- printNix <$> hnixEvalFile file
evalResult `seq` assertFailure $
file ++ " should not evaluate.\nThe evaluation result was `"
++ evalResult ++ "`."

View File

@ -1,16 +1,16 @@
module TestCommon where
import Nix
import Nix.Monad
import Nix.Monad.Instance
import Nix.Parser
import Nix.Pretty
import System.Directory
import System.Environment
import System.IO
import System.Posix.Temp
import System.Process
import Test.Tasty.HUnit
import Nix
import Nix.Monad.Instance
import Nix.Parser
import Nix.Pretty
import Nix.Value
import System.Environment
import System.IO
import System.Posix.Files
import System.Posix.Temp
import System.Process
import Test.Tasty.HUnit
hnixEvalFile :: FilePath -> IO (NValueNF (Lazy IO))
hnixEvalFile file = do
@ -23,8 +23,7 @@ hnixEvalFile file = do
evalLoc (Just file) expression
hnixEvalString :: String -> IO (NValueNF (Lazy IO))
hnixEvalString expr = do
case parseNixString expr of
hnixEvalString expr = case parseNixString expr of
Failure err ->
error $ "Parsing failed for expressien `" ++ expr ++ "`.\n" ++ show err
Success expression -> eval Nothing expression
@ -35,13 +34,11 @@ nixEvalString expr = do
hPutStr h expr
hClose h
res <- nixEvalFile fp
removeFile fp
removeLink fp
return res
nixEvalFile :: FilePath -> IO String
nixEvalFile fp = do
readProcess "nix-instantiate" ["--eval", fp] ""
nixEvalFile fp = readProcess "nix-instantiate" ["--eval", fp] ""
assertEvalMatchesNix :: String -> Assertion
assertEvalMatchesNix expr = do