Skip to content

Commit 19e614b

Browse files
committed
smoke-test the transcript _helpless sends to the duck
_help50_button hands the payload to command50 with output discarded, so no check could see it. Stub it and assert both forms: with a command line, "$ cmd" then the output; without one, the output alone. Whitespace-only output still hides the button even when a command line is supplied.
1 parent 35a2c79 commit 19e614b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tests/smoke.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ if run "$IMAGE" bash --login -c 'test -f /etc/profile.d/help50.sh -a -f /opt/cs5
3838
test -z "$(_helpless " " 2>&1)" &&
3939
_helpless "cat: x: No such file" 2>&1 | grep -q help50'
4040

41+
# _help50_button discards command50's output, so stub it to see the payload
42+
check "the duck gets the command line and output as a transcript (or output alone without a command)"
43+
run "$IMAGE" bash --login -c '
44+
_alert() { :; }
45+
_help50_button() { printf "%s" "$2"; }
46+
test "$(_helpless "cat: x: No such file" "cat x")" = "$(printf "%s\n%s" "$ cat x" "cat: x: No such file")" &&
47+
test "$(_helpless "cat: x: No such file")" = "cat: x: No such file" &&
48+
test -z "$(_helpless " " "cat x")"'
49+
4150
check "root shells (Sysadmins profile) do not start help50"
4251
run --user root "$IMAGE" bash --login -c 'test -z "${HELP50:-}" && ! declare -F _helpful > /dev/null'
4352
else

0 commit comments

Comments
 (0)