Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: NixLanguageTests: enable test 'eval-okay-hashfile' #1021

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Nix/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,18 @@ hashStringNix nsAlgo ns =
mkHash s = hash $ encodeUtf8 s


-- | hashFileNix
-- use hashStringNix to hash file content
hashFileNix
:: forall e t f m . MonadNix e t f m => NixString -> Path -> Prim m NixString
hashFileNix nsAlgo nvfilepath = Prim $ hash =<< fileContent
where
hash = outPrim . hashStringNix nsAlgo
outPrim (Prim x) = x
fileContent :: m NixString
fileContent = mkNixStringWithoutContext <$> Nix.Render.readFile nvfilepath


placeHolderNix :: forall t f m e . MonadNix e t f m => NValue t f m -> m (NValue t f m)
placeHolderNix p =
do
Expand Down Expand Up @@ -1849,6 +1861,7 @@ builtinsList =
, add2 Normal "hasAttr" hasAttrNix
, add Normal "hasContext" hasContextNix
, add' Normal "hashString" (hashStringNix @e @t @f @m)
, add' Normal "hashFile" hashFileNix
, add Normal "head" headNix
, add2 Normal "intersectAttrs" intersectAttrsNix
, add Normal "isAttrs" isAttrsNix
Expand Down
4 changes: 2 additions & 2 deletions tests/NixLanguageTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ groupBy key = Map.fromListWith (<>) . fmap (key &&& pure)
-- previously passed.
newFailingTests :: Set String
newFailingTests = Set.fromList
[ "eval-okay-hash"
, "eval-okay-hashfile"
[
"eval-okay-hash"
, "eval-okay-path" -- #128
, "eval-okay-types"
, "eval-okay-fromTOML"
Expand Down