This commit is contained in:
David Schroeder
2026-07-28 20:41:57 -05:00
parent 8418cbed56
commit 741e2ad9e8
4 changed files with 59 additions and 9 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
TEST_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P)"
# shellcheck source=../inc/secure-input.inc
source "${TEST_ROOT}/inc/secure-input.inc"
masked_value=''
output_file="$(mktemp)"
trap 'rm -f "$output_file"' EXIT
TAPM_READ_MASKED masked_value >"$output_file" <<'EOF'
TAPM-secret
EOF
if [[ "$masked_value" != 'TAPM-secret' ]]; then
printf 'FAIL: masked input did not preserve the entered value\n' >&2
exit 1
fi
if [[ "$(cat "$output_file")" != '***********' ]]; then
printf 'FAIL: masked input did not display one marker per character\n' >&2
exit 1
fi
printf 'PASS: masked secret input\n'