aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIsabel <isabel@isabelroses.com>2024-08-02 07:56:06 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-02 07:56:06 +0000
commit9eb374dc6da5cd0e8f96522342a5b0a27fc5946b (patch)
tree69b559e54e4433b501a4ae2ef60944dd90cc40f2 /tests
parent3bb8c627aecc4abd89e7863cc11a7aef1ee74ed7 (diff)
parentd2422771eb8e4186841ebab8ef486328e9a07d28 (diff)
Merge "nix flake show: add the description if it exists" into main
Diffstat (limited to 'tests')
-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'"