fix(cabal.project parser): parse the packages ending with eof (#222)

This commit is contained in:
Shivaraj B H 2024-02-06 13:38:48 +05:30 committed by GitHub
parent dd0d3b9d51
commit 56c5550e18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 2 deletions

View File

@ -5,6 +5,7 @@
- #210: Add `extraLibraries` to `settings` module.
- #215: Improved debug logging.
- #216: Remove `debug` option (pass `--trace-verbose` to nix instead)
- #222: Improve `cabal.project` parser by handling files not ending with newline
- Breaking changes
- #221: Switch to `buildFromSdist`, to allow using non-standard package sets (wherein `cabal-install` is otherwise built without using user's overrides)

View File

@ -25,7 +25,11 @@ in
key = parsec.string "packages:\n";
val =
parsec.many1
(parsec.between spaces1 newline path);
(parsec.choice
[
(parsec.between spaces1 newline path)
(parsec.between spaces1 parsec.eof path)
]);
parser = parsec.skipThen
key
val;

View File

@ -17,6 +17,15 @@ let
'';
expected = [ "foo" "bar" ];
};
# Handles cases where cabal.project does not end with newline
testEOF = {
expr = eval ''
packages:
foo
bar'';
expected = [ "foo" "bar" ];
};
};
cabalExecutableTests =
let

View File

@ -1,2 +1,2 @@
packages:
./haskell-flake-test
./haskell-flake-test