From 9fc7817e0e3222af9ca682d4e941f7e3032c41ae Mon Sep 17 00:00:00 2001 From: tristan Date: Mon, 1 Jan 2024 09:57:58 +0000 Subject: [PATCH] test file copying --- testing/it.nix | 3 ++- testing/site.test.nix | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/testing/it.nix b/testing/it.nix index 194b97b..c733c8f 100644 --- a/testing/it.nix +++ b/testing/it.nix @@ -1,5 +1,5 @@ msg: -{ actual, expected, asString ? false, asJSON ? false, removeDunders ? false, }: +{ actual, expected, asString ? false, asJSON ? false, removeDunders ? false, safeToPrint ? true }: let preProcess = v: if removeDunders then @@ -21,4 +21,5 @@ builtins.trace actual builtins.trace expected '' echo FAILED ${msg} + echo '${if safeToPrint then builtins.toJSON actual else ""}' '' diff --git a/testing/site.test.nix b/testing/site.test.nix index 734b7d5..b5d8c16 100644 --- a/testing/site.test.nix +++ b/testing/site.test.nix @@ -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 + + ''; + })) + ]