aboutsummaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorisabel <isabel@isabelroses.com>2024-06-27 15:35:55 -0400
committerisabel <isabel@isabelroses.com>2024-07-23 13:21:15 +0100
commitd2422771eb8e4186841ebab8ef486328e9a07d28 (patch)
tree52ea4d78afaaa2ec302cd68dc3356baa8deaacb8 /tests/functional
parent94a8e5fe0dcee9b079c7f0658680098a989affa1 (diff)
nix flake show: add the description if it exists
(cherry picked from commit 8cd1d02f90eb9915e640c5d370d919fad9833c65) nix flake show: Only print up to the first new line if it exists. (cherry picked from commit 5281a44927bdb51bfe6e5de12262d815c98f6fe7) add tests (cherry picked from commit 74ae0fbdc70a5079a527fe143c4832d1357011f7) Handle long strings, embedded new lines and empty descriptions (cherry picked from commit 2ca7b3afdbbd983173a17fa0a822cf7623601367) Account for total length of 80 (cherry picked from commit 1cc808c18cbaaf26aaae42bb1d7f7223f25dd364) docs: add nix flake show description release note fix: remove white space nix flake show: trim length based on terminal size test: account for terminal size docs(flake-description): before and after commands; add myself to credits Upstream-PR: https://github.com/NixOS/nix/pull/10980 Change-Id: Ie1c667dc816b3dd81e65a1f5395e57ea48ee0362
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/flakes/show.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/functional/flakes/show.sh b/tests/functional/flakes/show.sh
index a3d300552..25f481575 100644
--- a/tests/functional/flakes/show.sh
+++ b/tests/functional/flakes/show.sh
@@ -85,3 +85,31 @@ assert show_output.legacyPackages.${builtins.currentSystem}.AAAAAASomeThingsFail
assert show_output.legacyPackages.${builtins.currentSystem}.simple.name == "simple";
true
'
+
+cat >flake.nix<<EOF
+{
+ outputs = inputs: {
+ packages.$system = {
+ aNoDescription = import ./simple.nix;
+ bOneLineDescription = import ./simple.nix // { meta.description = "one line"; };
+ cMultiLineDescription = import ./simple.nix // { meta.description = ''
+ line one
+ line two
+ ''; };
+ dLongDescription = import ./simple.nix // { meta.description = ''
+ abcdefghijklmnopqrstuvwxyz
+ ''; };
+ eEmptyDescription = import ./simple.nix // { meta.description = ""; };
+ };
+ };
+}
+EOF
+unbuffer sh -c '
+ stty rows 20 cols 100
+ nix flake show > show-output.txt
+'
+test "$(awk -F '[:] ' '/aNoDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"
+test "$(awk -F '[:] ' '/bOneLineDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - 'one line'"
+test "$(awk -F '[:] ' '/cMultiLineDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - 'line one'"
+test "$(awk -F '[:] ' '/dLongDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - 'abcdefghijklmnopqrs...'"
+test "$(awk -F '[:] ' '/eEmptyDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"