lib/strings: add concatLines

Like `unlines` from Haskell.

The aim is to replace the `concatStringsSep "\n"` pattern for generated
files, which doesn't add a final newline.
This commit is contained in:
Naïm Favier
2022-12-10 15:56:30 +01:00
parent f8fc2323e9
commit ed0b8c26f1
3 changed files with 17 additions and 1 deletions

View File

@@ -153,6 +153,11 @@ runTests {
expected = "a,b,c";
};
testConcatLines = {
expr = concatLines ["a" "b" "c"];
expected = "a\nb\nc\n";
};
testSplitStringsSimple = {
expr = strings.splitString "." "a.b.c.d";
expected = [ "a" "b" "c" "d" ];