From 975bade7f0adb0d122eabeeca6ad44bf1d1f4366 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 15 Mar 2022 12:55:32 +0100 Subject: [PATCH] Implement simple test for `path`-fetcher setting a correct `lastModifiedDate` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> --- tests/fetchPath.sh | 6 ++++++ tests/local.mk | 1 + 2 files changed, 7 insertions(+) create mode 100644 tests/fetchPath.sh diff --git a/tests/fetchPath.sh b/tests/fetchPath.sh new file mode 100644 index 000000000..0cfdf68cf --- /dev/null +++ b/tests/fetchPath.sh @@ -0,0 +1,6 @@ +source common.sh + +touch foo -t 222211111111 +# We only check whether 2222-11-1* **:**:** is the last modified date since +# `lastModified` is transformed into UTC in `builtins.fetchTarball`. +[[ "$(nix eval --impure --raw --expr "(builtins.fetchTree \"path://$PWD/foo\").lastModifiedDate")" =~ 2222111.* ]] diff --git a/tests/local.mk b/tests/local.mk index 8032fc38a..b69fb9391 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -21,6 +21,7 @@ nix_tests = \ tarball.sh \ fetchGit.sh \ fetchurl.sh \ + fetchPath.sh \ simple.sh \ referrers.sh \ optimise-store.sh \