concatText: test now works

This commit is contained in:
Pasquale 2021-12-30 13:12:34 +01:00
parent 6f0eae6d37
commit 5187d2cd8f
No known key found for this signature in database
GPG Key ID: 13160FFB4CEB03F2
2 changed files with 8 additions and 14 deletions

View File

@ -1,18 +1,11 @@
{ callPackage, lib, pkgs, runCommand, writeText, writeStringReferencesToFile }:
{ callPackage, lib, pkgs, runCommand, concatText, writeText, hello }:
let
sample = import ./sample.nix { inherit pkgs; };
samplePaths = lib.unique (lib.attrValues sample);
str2drv = x: "${x}";
sampleText = concatText "cample-concat" (lib.unique (map str2drv samplePaths));
stringReferencesText =
writeStringReferencesToFile
((lib.concatMapStringsSep "fillertext"
stri
(lib.attrValues sample)) + ''
STORE=${builtins.storeDir};\nsystemctl start bar-foo.service
'');
stri = writeText "pathToTest";
txt1 = stri "abc";
txt2 = stri hello;
res = concatText "textToTest" [ txt1 txt2 ];
in
runCommand "test-writeStringReferencesToFile" { } ''
diff -U3 <(sort ${stringReferencesText}) <(sort ${sampleText})
runCommand "test-concatPaths" { } ''
diff -U3 <(cat ${txt1} ${txt2}) ${res}
touch $out
''

View File

@ -57,6 +57,7 @@ with pkgs;
writeStringReferencesToFile = callPackage ../build-support/trivial-builders/test/writeStringReferencesToFile.nix {};
references = callPackage ../build-support/trivial-builders/test/references.nix {};
overriding = callPackage ../build-support/trivial-builders/test-overriding.nix {};
concat = callPackage ../build-support/trivial-builders/test/concat-test.nix {};
};
writers = callPackage ../build-support/writers/test.nix {};