Merge remote-tracking branch 'origin/master' into pending
This commit is contained in:
commit
c6718e374f
|
@ -65,6 +65,10 @@ drv = haskellPackages.developPackage {
|
|||
else {};
|
||||
|
||||
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
|
||||
buildTools = (attrs.buildTools or []) ++ [
|
||||
pkgs.haskell.packages.${compiler}.cabal-install
|
||||
];
|
||||
|
||||
testHaskellDepends = attrs.testHaskellDepends ++
|
||||
[ pkgs.nix
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ module Nix.Exec where
|
|||
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import Control.Monad.Catch
|
||||
import Control.Monad.Catch hiding (catchJust)
|
||||
import Control.Monad.Fix
|
||||
import Control.Monad.IO.Class
|
||||
import Control.Monad.Reader
|
||||
|
@ -48,6 +48,7 @@ import Data.Monoid
|
|||
import Data.Text (Text)
|
||||
import qualified Data.Text as Text
|
||||
import Data.Typeable
|
||||
import GHC.IO.Exception (IOErrorType(..))
|
||||
import Network.HTTP.Client
|
||||
import Network.HTTP.Client.TLS
|
||||
import Network.HTTP.Types
|
||||
|
@ -75,6 +76,7 @@ import System.Environment
|
|||
import System.Exit (ExitCode (ExitSuccess))
|
||||
import System.FilePath
|
||||
import qualified System.Info
|
||||
import System.IO.Error
|
||||
import System.Posix.Files
|
||||
import System.Process (readProcessWithExitCode)
|
||||
import Text.PrettyPrint.ANSI.Leijen (text)
|
||||
|
@ -533,7 +535,12 @@ instance (MonadFix m, MonadCatch m, MonadIO m, Alternative m,
|
|||
|
||||
findPath = findPathM
|
||||
|
||||
pathExists = liftIO . fileExist
|
||||
pathExists fp = liftIO $ catchJust
|
||||
-- "inappropriate type" error is thrown if `fileExist` is given a filepath where
|
||||
-- a plain file appears as a directory, i.e. /bin/sh/nonexistent-file
|
||||
(\ e -> guard (ioeGetErrorType e == InappropriateType) >> pure e)
|
||||
(fileExist fp)
|
||||
(\ _ -> return False)
|
||||
|
||||
importPath scope origPath = do
|
||||
path <- liftIO $ pathToDefaultNixFile origPath
|
||||
|
|
|
@ -205,7 +205,8 @@ exprFNixDoc = \case
|
|||
NSelect r attr o ->
|
||||
(if isJust o then leastPrecedence else flip mkNixDoc selectOp) $
|
||||
wrapPath selectOp r <> dot <> prettySelector attr <> ordoc
|
||||
where ordoc = maybe empty (((space <> text "or") <+>) . wrapParens selectOp) o
|
||||
where
|
||||
ordoc = maybe empty (((space <> text "or") <+>) . wrapParens appOpNonAssoc) o
|
||||
NHasAttr r attr ->
|
||||
mkNixDoc (wrapParens hasAttrOp r <+> text "?" <+> prettySelector attr) hasAttrOp
|
||||
NEnvPath p -> simpleExpr $ text ("<" ++ p ++ ">")
|
||||
|
|
|
@ -219,7 +219,10 @@ isClosureNF _ = False
|
|||
|
||||
thunkEq :: MonadThunk (NValue m) (NThunk m) m
|
||||
=> NThunk m -> NThunk m -> m Bool
|
||||
thunkEq lt rt = force lt $ \lv -> force rt $ \rv -> valueEq lv rv
|
||||
thunkEq lt rt = force lt $ \lv -> force rt $ \rv ->
|
||||
case (lv, rv) of
|
||||
(NVClosure _ _, NVClosure _ _) -> pure True
|
||||
_ -> valueEq lv rv
|
||||
|
||||
-- | Checks whether two containers are equal, using the given item equality
|
||||
-- predicate. If there are any item slots that don't match between the two
|
||||
|
|
|
@ -277,6 +277,18 @@ case_fixed_points_attrsets =
|
|||
in fix f
|
||||
|]
|
||||
|
||||
case_function_equals1 =
|
||||
constantEqualText "true" "{f = x: x;} == {f = x: x;}"
|
||||
|
||||
case_function_equals2 =
|
||||
constantEqualText "true" "[(x: x)] == [(x: x)]"
|
||||
|
||||
case_function_equals3 =
|
||||
constantEqualText "false" "(x: x) == (x: x)"
|
||||
|
||||
case_directory_pathexists =
|
||||
constantEqualText "false" "builtins.pathExists \"/bin/sh/invalid-directory\""
|
||||
|
||||
-- jww (2018-05-02): This constantly changes!
|
||||
-- case_placeholder =
|
||||
-- constantEqualText
|
||||
|
|
|
@ -27,7 +27,7 @@ import qualified NixLanguageTests
|
|||
import qualified ParserTests
|
||||
import qualified PrettyTests
|
||||
import qualified ReduceExprTests
|
||||
-- import qualified PrettyParseTests
|
||||
import qualified PrettyParseTests
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
import System.FilePath.Glob
|
||||
|
@ -91,7 +91,7 @@ main = do
|
|||
evalComparisonTests <- EvalTests.genEvalCompareTests
|
||||
let allOrLookup var = lookupEnv "ALL_TESTS" <|> lookupEnv var
|
||||
nixpkgsTestsEnv <- allOrLookup "NIXPKGS_TESTS"
|
||||
-- prettyTestsEnv <- lookupEnv "PRETTY_TESTS"
|
||||
prettyTestsEnv <- lookupEnv "PRETTY_TESTS"
|
||||
hpackTestsEnv <- allOrLookup "HPACK_TESTS"
|
||||
|
||||
pwd <- getCurrentDirectory
|
||||
|
@ -104,11 +104,10 @@ main = do
|
|||
, EvalTests.tests
|
||||
, PrettyTests.tests
|
||||
, ReduceExprTests.tests] ++
|
||||
-- [ PrettyParseTests.tests
|
||||
-- (fromIntegral (read (fromMaybe "0" prettyTestsEnv) :: Int)) ] ++
|
||||
[ PrettyParseTests.tests
|
||||
(fromIntegral (read (fromMaybe "0" prettyTestsEnv) :: Int)) ] ++
|
||||
[ evalComparisonTests ] ++
|
||||
[ testCase "Nix language tests present" ensureLangTestsPresent
|
||||
, nixLanguageTests ] ++
|
||||
[ testCase "Nixpkgs parses without errors" ensureNixpkgsCanParse
|
||||
| isJust nixpkgsTestsEnv ]
|
||||
|
||||
|
|
Loading…
Reference in a new issue