-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interpolation: only quote multi-word values (#100)
- Fixes #99 - adds `platform::existing_command`
- Loading branch information
1 parent
97329b9
commit 0c960fc
Showing
4 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
interpolation_one_word() { | ||
echo "curl http://mysite.com/<user>/profile" \ | ||
| arg::interpolate "user" "john" \ | ||
| test::equals "curl http://mysite.com/john/profile" | ||
} | ||
|
||
interpolation_multiple_words() { | ||
echo "cp <file> <new_file>" \ | ||
| 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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
existing() { | ||
platform::existing_command oasida fngo ni awk aoisdn oafm \ | ||
| test::equals awk | ||
} | ||
|
||
test::set_suite "platform" | ||
test::run "existing_command" existing |