Created
May 17, 2021 09:00
-
-
Save dezza/4b265874d6069cbf34585933f0bb602d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
assertequal () { | |
(( testcount=testcount+1 )) | |
if [ "$1" = "$2" ]; then | |
echo "${testcount} PASS: $3" | |
else | |
echo "${testcount} FAIL: expected output failed" | |
fi | |
} | |
testcount=0 | |
read -r -d '' assert_output <<'EOF' | |
ssh_keys=() array not set | |
ssh_keys_init variable not set | |
EOF | |
test=$(zsh -f keychain.zsh) | |
assertequal $test $assert_output "ssh_keys, ssh_keys_init not set" | |
test=$(ssh_keys_init=lazy zsh -f keychain.zsh) | |
read -r -d '' assert_output <<'EOF' | |
ssh_keys=() array not set | |
EOF | |
unset ssh_keys_init | |
assertequal $test $assert_output "ssh_keys not set" | |
test=$(ssh_keys=\(test\) zsh -f keychain.zsh) | |
read -r -d '' assert_output <<'EOF' | |
ssh_keys_init variable not set | |
EOF | |
unset ssh_keys | |
assertequal $test $assert_output "ssh_keys_init not set" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment