[lang-ref] ( accept_keyboard_input ) ( bash )
@test "accept keyboard input" {
# read -r
input=$'Open sesame\n'
accept_keyboard_input() {
local answer
printf "What's the magic word?"
IFS= read -r answer
[ "$answer" = "Open sesame" ]
}
# pass by pipe here for test
accept_keyboard_input <<< "$input"
}