navi/test/arg_test.sh

19 lines
704 B
Bash
Raw Normal View History

#!/usr/bin/env bash
interpolation_one_word() {
echo "curl http://mysite.com/<user>/profile" \
2019-10-03 15:56:36 +00:00
| arg::interpolate "user" "john" \
| test::equals "curl http://mysite.com/john/profile"
}
interpolation_multiple_words() {
echo "cp <file> <new_file>" \
2019-10-03 15:56:36 +00:00
| arg::interpolate "file" "C:/Program Files/app/foo.exe" \
| arg::interpolate "new_file" "/mnt/c/Users/john/foo.exe" \
| test::equals 'cp "C:/Program Files/app/foo.exe" /mnt/c/Users/john/foo.exe'
}
test::set_suite "arg"
test::run "if there's only one word, interpolation doesn't include quotes" interpolation_one_word
test::run "if there are multiple words, interpolation includes quotes" interpolation_multiple_words