update
This commit is contained in:
@@ -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'
|
||||
Reference in New Issue
Block a user