packages feed

nix-narinfo 0.1.0.2 → 0.1.1.0

raw patch · 6 files changed

+36/−9 lines, 6 files

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# Version [0.1.1.0](https://github.com/sorki/nix-narinfo/compare/0.1.0.2...0.1.1.0) (2023-11-21)++* Fixed parsing of empty references [#4](https://github.com/sorki/nix-narinfo/pull/4)+ # Version [0.1.0.2](https://github.com/sorki/nix-narinfo/compare/0.1.0.1...0.1.0.2) (2023-11-09)  * Add hspec-discover to build-tool-depends
README.md view
@@ -1,5 +1,8 @@-nix-narinfo-===========+# nix-narinfo++[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sorki/nix-narinfo/ci.yaml?branch=master)](https://github.com/sorki/nix-narinfo/actions/workflows/ci.yaml)+[![Hackage version](https://img.shields.io/hackage/v/nix-narinfo.svg?color=success)](https://hackage.haskell.org/package/nix-narinfo)+[![Dependencies](https://img.shields.io/hackage-deps/v/nix-narinfo?label=Dependencies)](https://packdeps.haskellers.com/feed?needle=nix-narinfo)  Parse and build `.narinfo` files. 
nix-narinfo.cabal view
@@ -1,5 +1,5 @@ name:                nix-narinfo-version:             0.1.0.2+version:             0.1.1.0 synopsis:            Parse and render .narinfo files description:         Support for parsing and rendering Nix .narinfo files homepage:            https://github.com/sorki/nix-narinfo@@ -16,6 +16,7 @@     CHANGELOG.md     README.md     test/samples/0+    test/samples/1     test/samples/guix0  library
src/Nix/NarInfo/Parser.hs view
@@ -21,7 +21,7 @@ parseNarInfo :: Parser (NarInfo FilePath Text Text) parseNarInfo = parseNarInfoWith pathParse textParse hashParse   where-    textParse = Data.Attoparsec.Text.takeWhile (not . Data.Char.isSpace)+    textParse = Data.Attoparsec.Text.takeWhile1 (not . Data.Char.isSpace)     pathParse _hasPrefix = Data.Text.unpack <$> textParse     hashParse = textParse 
test/ParseSpec.hs view
@@ -11,18 +11,27 @@  import SpecHelper -roundTrip fname = do+parseSample fname = do   txt <- Data.Text.IO.readFile $ "./test/samples/" ++ fname   case Data.Attoparsec.Text.parseOnly parseNarInfo txt of     Left e -> error e-    Right ni -> do-      let built = Data.Text.Lazy.Builder.toLazyText $ buildNarInfo ni-      (Data.Text.Lazy.toStrict built) `shouldBe` txt+    Right ni -> pure (txt, ni) +roundTrip fname = do+  (txt, ni) <- parseSample fname+  let built = Data.Text.Lazy.Builder.toLazyText $ buildNarInfo ni+  (Data.Text.Lazy.toStrict built) `shouldBe` txt++referencesEmpty fname = do+  (_, ni) <- parseSample fname+  references ni `shouldSatisfy` Prelude.null+ spec :: Spec spec = do   it "roundtrips samples" $ do-    mapM_ (roundTrip . show) [0]+    mapM_ (roundTrip . show) [0, 1]+  it "parses empty references" $ do+    mapM_ (referencesEmpty . show) [1]  main :: IO () main = hspec spec
+ test/samples/1 view
@@ -0,0 +1,10 @@+StorePath: /nix/store/jd99cyc0251p0i5y69w8mqjcai8mcq7h-xgcc-12.2.0-libgcc+URL: nar/19sqyfks8im2vwa88scbr59p7fsiqlrzjchzgfsiv6phsj347cr8.nar.xz+Compression: xz+FileHash: sha256:19sqyfks8im2vwa88scbr59p7fsiqlrzjchzgfsiv6phsj347cr8+FileSize: 51168+NarHash: sha256:1kkya9i8g3x0r9qwisb7ln5iacqbydcijz91isksgxs6qlz4vhrs+NarSize: 142624+References: +Deriver: q072lsl54bjjlgsj06w7fb431cz2ckci-xgcc-12.2.0.drv+Sig: cache.nixos.org-1:3HOgd2rfiGhjncReE/SkoNmYf0mwCgQGAkjq4lFsr+sZQlQ7R33T/G6fnzEcnnxHVxuxf1Su03miIFCK1xoCBA==