aboutsummaryrefslogtreecommitdiff
path: root/tests/why-depends.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/why-depends.sh')
-rw-r--r--tests/why-depends.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/why-depends.sh b/tests/why-depends.sh
index 11b54b5b6..c12941e76 100644
--- a/tests/why-depends.sh
+++ b/tests/why-depends.sh
@@ -9,5 +9,13 @@ cd $TEST_HOME
nix-build ./dependencies.nix -A input0_drv -o dep
nix-build ./dependencies.nix -o toplevel
-nix why-depends ./toplevel ./dep |
- grep input-2
+FAST_WHY_DEPENDS_OUTPUT=$(nix why-depends ./toplevel ./dep)
+PRECISE_WHY_DEPENDS_OUTPUT=$(nix why-depends ./toplevel ./dep --precise)
+
+# Both outputs should show that `input-2` is in the dependency chain
+echo "$FAST_WHY_DEPENDS_OUTPUT" | grep -q input-2
+echo "$PRECISE_WHY_DEPENDS_OUTPUT" | grep -q input-2
+
+# But only the “precise” one should refere to `reference-to-input-2`
+echo "$FAST_WHY_DEPENDS_OUTPUT" | (! grep -q reference-to-input-2)
+echo "$PRECISE_WHY_DEPENDS_OUTPUT" | grep -q reference-to-input-2