Skip to content

Commit

Permalink
Don't remove _ and -symbols when fake commands
Browse files Browse the repository at this point in the history
We have to keep `_` and `-` symbols when fake commands as they will
provide better differentiation between commands or their arguments.

#194
  • Loading branch information
extsoft committed Sep 30, 2019
1 parent 4b8e27b commit c05bfb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/addons-fake.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fake() {
# sample: fake <command> <exit> <stdout> <stderr>
local executable=$(basename ${1%% *})
local fake_directory="${FAKES_DIRECTORY}/${executable}-app"
local command_directory="${fake_directory}/$(echo "${1}" | sed 's/[^0-9a-zA-Z]*//g')"
local command_directory="${fake_directory}/$(echo "${1}" | sed 's/[^0-9a-zA-Z_-]*//g')"
local fake="${FAKES_DIRECTORY}/${executable}"

if [[ ! -e "${fake}" ]]; then
Expand All @@ -31,7 +31,7 @@ fake() {
# It's purpose is to use a mock, if available, otherwise,
# run original executable.
root_directory=${fake_directory}
command_directory="\${root_directory}/\$(echo "${executable} \${@}" | sed 's/[^0-9a-zA-Z]*//g')"
command_directory="\${root_directory}/\$(echo "${executable} \${@}" | sed 's/[^0-9a-zA-Z_-]*//g')"
if [[ -e "\${command_directory}" ]]; then
cat "\${command_directory}/stdout"
cat "\${command_directory}/stderr" >&2
Expand Down
2 changes: 1 addition & 1 deletion tests/git-elegant-accept-work.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
fake-pass "git merge --ff-only __eg"
fake-pass "git push origin master:master"
fake-pass "git branch --delete --force __eg"
fake-pass "git for-each-ref --format='%(upstream:short)' refs/heads/_eg}" "origin/test-feature"
fake-pass "git for-each-ref --format='%(upstream:short)' refs/heads/__eg}" "origin/test-feature"
fake-pass "git push origin --delete test-feature"
}

Expand Down

0 comments on commit c05bfb0

Please sign in to comment.