Some minor fixups for compilation
This commit is contained in:
parent
deb592b11d
commit
c8e9012778
|
@ -2,7 +2,7 @@
|
||||||
--
|
--
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
--
|
--
|
||||||
-- hash: 429fc2370bb078161c283b1238eb797ca1c03c46e4c1a2f68ac80937a901bb79
|
-- hash: 2a22f1191905e2b66f2d356247a272e923144902c5ad6026fe72d137f8127a77
|
||||||
|
|
||||||
name: hnix
|
name: hnix
|
||||||
version: 0.5.0
|
version: 0.5.0
|
||||||
|
@ -135,6 +135,7 @@ test-suite hnix-tests
|
||||||
NixLanguageTests
|
NixLanguageTests
|
||||||
ParserTests
|
ParserTests
|
||||||
PrettyTests
|
PrettyTests
|
||||||
|
TestCommon
|
||||||
Paths_hnix
|
Paths_hnix
|
||||||
hs-source-dirs:
|
hs-source-dirs:
|
||||||
tests
|
tests
|
||||||
|
|
|
@ -23,7 +23,6 @@ import Nix.Utils
|
||||||
import Nix.Stack
|
import Nix.Stack
|
||||||
import Nix.Value
|
import Nix.Value
|
||||||
import Nix.XML
|
import Nix.XML
|
||||||
import System.Directory
|
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.FilePath.Glob (compile, globDir1)
|
import System.FilePath.Glob (compile, globDir1)
|
||||||
|
@ -128,7 +127,7 @@ assertEval files = catch go $ \case
|
||||||
|
|
||||||
assertEvalFail :: FilePath -> Assertion
|
assertEvalFail :: FilePath -> Assertion
|
||||||
assertEvalFail file = catch ?? (\(_ :: SomeException) -> return ()) $ do
|
assertEvalFail file = catch ?? (\(_ :: SomeException) -> return ()) $ do
|
||||||
evalResult <- printNix <$> nixEvalFile file
|
evalResult <- printNix <$> hnixEvalFile file
|
||||||
evalResult `seq` assertFailure $
|
evalResult `seq` assertFailure $
|
||||||
file ++ " should not evaluate.\nThe evaluation result was `"
|
file ++ " should not evaluate.\nThe evaluation result was `"
|
||||||
++ evalResult ++ "`."
|
++ evalResult ++ "`."
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
module TestCommon where
|
module TestCommon where
|
||||||
|
|
||||||
import Nix
|
import Nix
|
||||||
import Nix.Monad
|
import Nix.Monad.Instance
|
||||||
import Nix.Monad.Instance
|
import Nix.Parser
|
||||||
import Nix.Parser
|
import Nix.Pretty
|
||||||
import Nix.Pretty
|
import Nix.Value
|
||||||
import System.Directory
|
import System.Environment
|
||||||
import System.Environment
|
import System.IO
|
||||||
import System.IO
|
import System.Posix.Files
|
||||||
import System.Posix.Temp
|
import System.Posix.Temp
|
||||||
import System.Process
|
import System.Process
|
||||||
import Test.Tasty.HUnit
|
import Test.Tasty.HUnit
|
||||||
|
|
||||||
hnixEvalFile :: FilePath -> IO (NValueNF (Lazy IO))
|
hnixEvalFile :: FilePath -> IO (NValueNF (Lazy IO))
|
||||||
hnixEvalFile file = do
|
hnixEvalFile file = do
|
||||||
|
@ -23,8 +23,7 @@ hnixEvalFile file = do
|
||||||
evalLoc (Just file) expression
|
evalLoc (Just file) expression
|
||||||
|
|
||||||
hnixEvalString :: String -> IO (NValueNF (Lazy IO))
|
hnixEvalString :: String -> IO (NValueNF (Lazy IO))
|
||||||
hnixEvalString expr = do
|
hnixEvalString expr = case parseNixString expr of
|
||||||
case parseNixString expr of
|
|
||||||
Failure err ->
|
Failure err ->
|
||||||
error $ "Parsing failed for expressien `" ++ expr ++ "`.\n" ++ show err
|
error $ "Parsing failed for expressien `" ++ expr ++ "`.\n" ++ show err
|
||||||
Success expression -> eval Nothing expression
|
Success expression -> eval Nothing expression
|
||||||
|
@ -35,13 +34,11 @@ nixEvalString expr = do
|
||||||
hPutStr h expr
|
hPutStr h expr
|
||||||
hClose h
|
hClose h
|
||||||
res <- nixEvalFile fp
|
res <- nixEvalFile fp
|
||||||
removeFile fp
|
removeLink fp
|
||||||
return res
|
return res
|
||||||
|
|
||||||
nixEvalFile :: FilePath -> IO String
|
nixEvalFile :: FilePath -> IO String
|
||||||
nixEvalFile fp = do
|
nixEvalFile fp = readProcess "nix-instantiate" ["--eval", fp] ""
|
||||||
readProcess "nix-instantiate" ["--eval", fp] ""
|
|
||||||
|
|
||||||
|
|
||||||
assertEvalMatchesNix :: String -> Assertion
|
assertEvalMatchesNix :: String -> Assertion
|
||||||
assertEvalMatchesNix expr = do
|
assertEvalMatchesNix expr = do
|
||||||
|
|
Loading…
Reference in a new issue