From e7c1113a37e6a8fd0dc2dde0d070dbef276a0481 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 17 May 2023 17:31:33 -0400 Subject: [PATCH] Add test for `downstreamPlaceholder` This is good in general, but in particular ensures when we heavily refactor it in the next commit there is less likelihood for an unintentional change in behavior to sneak in. --- src/libstore/tests/downstream-placeholder.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/libstore/tests/downstream-placeholder.cc diff --git a/src/libstore/tests/downstream-placeholder.cc b/src/libstore/tests/downstream-placeholder.cc new file mode 100644 index 000000000..7b8e2c649 --- /dev/null +++ b/src/libstore/tests/downstream-placeholder.cc @@ -0,0 +1,16 @@ +#include + +#include "derivations.hh" + +namespace nix { + +TEST(Derivation, downstreamPlaceholder) { + ASSERT_EQ( + downstreamPlaceholder( + (const Store &)*(const Store *)nullptr, // argument is unused + StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" }, + "out"), + "/0c6rn30q4frawknapgwq386zq358m8r6msvywcvc89n6m5p2dgbz"); +} + +}