aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/flakes/show.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/functional/flakes/show.sh b/tests/functional/flakes/show.sh
index 857c77ae1..3461597ee 100644
--- a/tests/functional/flakes/show.sh
+++ b/tests/functional/flakes/show.sh
@@ -107,10 +107,23 @@ EOF
runinpty sh -c '
stty rows 20 cols 100
- nix flake show > show-output.txt
-'
+ TERM=xterm-256color NOCOLOR=1 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 '[:] ' '/dLongDescription/{print $NF}' ./show-output.txt)" = "package 'simple' - 'abcdefghijklmnopqrstu…'"
+test "$(awk -F '[:] ' '/eEmptyDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"
+
+# validate that having a broken window size does not cause anything to explode
+# and that descriptions are just not printed if there is no space at all
+runinpty sh -c '
+ stty rows 0 cols 0
+ TERM=xterm-256color NOCOLOR=1 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'"
+test "$(awk -F '[:] ' '/cMultiLineDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"
+test "$(awk -F '[:] ' '/dLongDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"
test "$(awk -F '[:] ' '/eEmptyDescription/{print $NF}' ./show-output.txt)" = "package 'simple'"