test file copying

This commit is contained in:
tristan 2024-01-01 09:57:58 +00:00
parent b788aa4416
commit 9fc7817e0e
2 changed files with 19 additions and 1 deletions

View file

@ -1,5 +1,5 @@
msg: msg:
{ actual, expected, asString ? false, asJSON ? false, removeDunders ? false, }: { actual, expected, asString ? false, asJSON ? false, removeDunders ? false, safeToPrint ? true }:
let let
preProcess = v: preProcess = v:
if removeDunders then if removeDunders then
@ -21,4 +21,5 @@ builtins.trace actual
builtins.trace expected builtins.trace expected
'' ''
echo FAILED ${msg} echo FAILED ${msg}
echo '${if safeToPrint then builtins.toJSON actual else ""}'
'' ''

View file

@ -218,4 +218,21 @@ in with site; [
}; };
})) }))
(it "copies all the files" ({
actual = copyTo "." {
page = "this is a page";
subdir = {
page = "this page is in a subdir";
link = ./src;
};
};
expected = ''
cp /nix/store/crirfz0n6f8dgl1si3x7pwyw7fqm0r8l-page ./page
mkdir -p ./subdir
cp -r /nix/store/q95cn7ccixzi9w22aic4bl0ykk40ka7v-src ./subdir/link
cp /nix/store/ic6fyy8wg8r4338a3m5kinmg11igxsyj-page ./subdir/page
'';
}))
] ]