-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify the assertions look for all tests
For consistency, now all tests follow the following: 1. all assertions are in double square quotes like [[ .... ]] 2. left part of the assertions is described without quotes 3. all variables are in ${...} format
- Loading branch information
Showing
13 changed files
with
188 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,73 +18,73 @@ teardown() { | |
|
||
@test "'acquire-git': all configurations work as expected" { | ||
check git-elegant acquire-git | ||
[[ "${status}" -eq 0 ]] | ||
[[ ${status} -eq 0 ]] | ||
} | ||
|
||
@test "'acquire-git': basics are configured as expected" { | ||
check git-elegant acquire-git | ||
[[ "${lines[@]}" =~ "Please hit enter if you wish {default value}." ]] | ||
[[ "${lines[@]}" =~ "What is your user name? {Elegant Git}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global user.name Elegant Git" ]] | ||
[[ "${lines[@]}" =~ "What is your user email? {[email protected]}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global user.email [email protected]" ]] | ||
[[ "${lines[@]}" =~ "Please specify a command to start the editor. {vi}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global core.editor vi" ]] | ||
[[ ${lines[@]} =~ "Please hit enter if you wish {default value}." ]] | ||
[[ ${lines[@]} =~ "What is your user name? {Elegant Git}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --global user.name Elegant Git" ]] | ||
[[ ${lines[@]} =~ "What is your user email? {[email protected]}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --global user.email [email protected]" ]] | ||
[[ ${lines[@]} =~ "Please specify a command to start the editor. {vi}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.editor vi" ]] | ||
} | ||
|
||
@test "'acquire-git': standards are configured as expected on Windows" { | ||
fake-pass "uname -s" Windows | ||
check git-elegant acquire-git | ||
[[ "${lines[@]}" =~ "==>> git config --global core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global apply.whitespace fix" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global fetch.prune true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global fetch.pruneTags false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global core.autocrlf true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global pull.rebase true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global rebase.autoStash false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global elegant.acquired true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global apply.whitespace fix" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global fetch.prune true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global fetch.pruneTags false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.autocrlf true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global pull.rebase true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global rebase.autoStash false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global elegant.acquired true" ]] | ||
# negative checks are used instead of checking commands size | ||
[[ ! "${lines[@]}" =~ "==>> git config --global credential.helper osxkeychain" ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --global core.autocrlf input" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --global credential.helper osxkeychain" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --global core.autocrlf input" ]] | ||
} | ||
|
||
@test "'acquire-git': standards are configured as expected on Linux" { | ||
fake-pass "uname -s" Linux | ||
check git-elegant acquire-git | ||
[[ "${lines[@]}" =~ "==>> git config --global core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global apply.whitespace fix" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global fetch.prune true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global fetch.pruneTags false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global core.autocrlf input" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global pull.rebase true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global rebase.autoStash false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global elegant.acquired true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global apply.whitespace fix" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global fetch.prune true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global fetch.pruneTags false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.autocrlf input" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global pull.rebase true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global rebase.autoStash false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global elegant.acquired true" ]] | ||
# negative checks are used instead of checking commands size | ||
[[ ! "${lines[@]}" =~ "==>> git config --global credential.helper osxkeychain" ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --global core.autocrlf true" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --global credential.helper osxkeychain" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --global core.autocrlf true" ]] | ||
} | ||
|
||
@test "'acquire-git': standards are configured as expected on Darwin" { | ||
fake-pass "uname -s" Darwin | ||
check git-elegant acquire-git | ||
[[ "${lines[@]}" =~ "==>> git config --global core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global apply.whitespace fix" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global fetch.prune true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global fetch.pruneTags false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global core.autocrlf input" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global pull.rebase true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global rebase.autoStash false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global credential.helper osxkeychain" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global elegant.acquired true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global apply.whitespace fix" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global fetch.prune true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global fetch.pruneTags false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.autocrlf input" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global pull.rebase true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global rebase.autoStash false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global credential.helper osxkeychain" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global elegant.acquired true" ]] | ||
# negative checks are used instead of checking commands size | ||
[[ ! "${lines[@]}" =~ "==>> git config --global core.autocrlf true" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --global core.autocrlf true" ]] | ||
} | ||
|
||
@test "'acquire-git': new aliases are configured as expected" { | ||
check git-elegant acquire-git | ||
for next in $(git-elegant show-commands); do | ||
echo "Test aliasing of '${next}' command" | ||
[[ "${lines[@]}" =~ "==>> git config --global alias.${next} elegant ${next}" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global alias.${next} elegant ${next}" ]] | ||
echo "Tested successfully!" | ||
done | ||
} | ||
|
@@ -93,26 +93,26 @@ teardown() { | |
repo git config --global "alias.aaa" "\"elegant aaa\"" | ||
repo git config --global "alias.bbb" "\"elegant bbb\"" | ||
check git-elegant acquire-git | ||
[[ "$status" -eq 0 ]] | ||
[[ "${lines[@]}" =~ "2 Elegant Git aliases were removed." ]] | ||
[[ ${status} -eq 0 ]] | ||
[[ ${lines[@]} =~ "2 Elegant Git aliases were removed." ]] | ||
} | ||
|
||
@test "'acquire-git': a message is displayed if global configuration is disabled" { | ||
read-clean | ||
read-answer "n" | ||
check git-elegant acquire-git | ||
[[ "$status" -eq 0 ]] | ||
[[ "${lines[@]}" =~ "You've decided to stay with local configurations. Great!" ]] | ||
[[ ${status} -eq 0 ]] | ||
[[ ${lines[@]} =~ "You've decided to stay with local configurations. Great!" ]] | ||
} | ||
|
||
@test "'acquire-git': the basics are not changed if they are already configured" { | ||
repo git config --global user.name aaaa | ||
repo git config --global user.email aaaa | ||
repo git config --global core.editor aaaa | ||
check git-elegant acquire-git | ||
[[ "$status" -eq 0 ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global user.name aaaa" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global user.email aaaa" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --global core.editor aaaa" ]] | ||
[[ ! "${lines[@]}" =~ "Please hit enter if you wish {default value}." ]] | ||
[[ ${status} -eq 0 ]] | ||
[[ ${lines[@]} =~ "==>> git config --global user.name aaaa" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global user.email aaaa" ]] | ||
[[ ${lines[@]} =~ "==>> git config --global core.editor aaaa" ]] | ||
[[ ! ${lines[@]} =~ "Please hit enter if you wish {default value}." ]] | ||
} |
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 |
---|---|---|
|
@@ -18,69 +18,69 @@ teardown() { | |
|
||
@test "'acquire-repository': all configurations work as expected" { | ||
check git-elegant acquire-repository | ||
[[ "${status}" -eq 0 ]] | ||
[[ ${status} -eq 0 ]] | ||
} | ||
|
||
@test "'acquire-repository': basics are configured as expected" { | ||
check git-elegant acquire-repository | ||
[[ "${lines[@]}" =~ "What is your user name? {Elegant Git}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local user.name Elegant Git" ]] | ||
[[ "${lines[@]}" =~ "What is your user email? {[email protected]}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local user.email [email protected]" ]] | ||
[[ "${lines[@]}" =~ "Please specify a command to start the editor. {vi}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local core.editor vi" ]] | ||
[[ ${lines[@]} =~ "What is your user name? {Elegant Git}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --local user.name Elegant Git" ]] | ||
[[ ${lines[@]} =~ "What is your user email? {[email protected]}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --local user.email [email protected]" ]] | ||
[[ ${lines[@]} =~ "Please specify a command to start the editor. {vi}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.editor vi" ]] | ||
} | ||
|
||
@test "'acquire-repository': standards are configured as expected on Windows" { | ||
fake-pass "uname -s" Windows | ||
check git-elegant acquire-repository | ||
[[ "${lines[@]}" =~ "==>> git config --local core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local apply.whitespace fix" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local fetch.prune true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local fetch.pruneTags false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local core.autocrlf true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local pull.rebase true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local rebase.autoStash false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local apply.whitespace fix" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local fetch.prune true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local fetch.pruneTags false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.autocrlf true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local pull.rebase true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local rebase.autoStash false" ]] | ||
# negative checks are used instead of checking commands size | ||
[[ ! "${lines[@]}" =~ "==>> git config --local credential.helper osxkeychain" ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --local core.autocrlf input" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local credential.helper osxkeychain" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local core.autocrlf input" ]] | ||
} | ||
|
||
@test "'acquire-repository': standards are configured as expected on Linux" { | ||
fake-pass "uname -s" Linux | ||
check git-elegant acquire-repository | ||
[[ "${lines[@]}" =~ "==>> git config --local core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local apply.whitespace fix" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local fetch.prune true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local fetch.pruneTags false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local core.autocrlf input" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local pull.rebase true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local rebase.autoStash false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local apply.whitespace fix" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local fetch.prune true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local fetch.pruneTags false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.autocrlf input" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local pull.rebase true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local rebase.autoStash false" ]] | ||
# negative checks are used instead of checking commands size | ||
[[ ! "${lines[@]}" =~ "==>> git config --local credential.helper osxkeychain" ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --local core.autocrlf true" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local credential.helper osxkeychain" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local core.autocrlf true" ]] | ||
} | ||
|
||
@test "'acquire-repository': standards are configured as expected on Darwin" { | ||
fake-pass "uname -s" Darwin | ||
check git-elegant acquire-repository | ||
[[ "${lines[@]}" =~ "==>> git config --local core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local apply.whitespace fix" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local fetch.prune true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local fetch.pruneTags false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local core.autocrlf input" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local pull.rebase true" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local rebase.autoStash false" ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local credential.helper osxkeychain" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local apply.whitespace fix" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local fetch.prune true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local fetch.pruneTags false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local core.autocrlf input" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local pull.rebase true" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local rebase.autoStash false" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local credential.helper osxkeychain" ]] | ||
# negative checks are used instead of checking commands size | ||
[[ ! "${lines[@]}" =~ "==>> git config --local core.autocrlf true" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local core.autocrlf true" ]] | ||
} | ||
|
||
@test "'acquire-repository': new aliases are configured as expected" { | ||
check git-elegant acquire-repository | ||
for next in $(git-elegant show-commands); do | ||
echo "Test aliasing of '${next}' command" | ||
[[ "${lines[@]}" =~ "==>> git config --local alias.${next} elegant ${next}" ]] | ||
[[ ${lines[@]} =~ "==>> git config --local alias.${next} elegant ${next}" ]] | ||
echo "Tested successfully!" | ||
done | ||
} | ||
|
@@ -89,8 +89,8 @@ teardown() { | |
repo git config --local "alias.aaa" "\"elegant aaa\"" | ||
repo git config --local "alias.bbb" "\"elegant bbb\"" | ||
check git-elegant acquire-repository | ||
[[ "$status" -eq 0 ]] | ||
[[ "${lines[@]}" =~ "2 Elegant Git aliases were removed." ]] | ||
[[ ${status} -eq 0 ]] | ||
[[ ${lines[@]} =~ "2 Elegant Git aliases were removed." ]] | ||
} | ||
|
||
@test "'acquire-repository': 'elegant.acquired' affects configuration correctly" { | ||
|
@@ -99,15 +99,15 @@ teardown() { | |
repo git config --global "alias.bbb" "\"elegant bbb\"" | ||
repo git config --global "elegant.acquired" "true" | ||
check git-elegant acquire-repository | ||
[[ "${lines[@]}" =~ "What is your user name? {Elegant Git}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local user.name Elegant Git" ]] | ||
[[ "${lines[@]}" =~ "What is your user email? {[email protected]}: " ]] | ||
[[ "${lines[@]}" =~ "==>> git config --local user.email [email protected]" ]] | ||
[[ ! "${lines[@]}" =~ "Please specify a command to start the editor. {vi}: " ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --local core.editor vi" ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --local core.commentChar |" ]] | ||
[[ "${lines[@]}" =~ "1 Elegant Git aliases were removed." ]] | ||
[[ ! "${lines[@]}" =~ "==>> git config --local alias.acquire-repository elegant acquire-repository" ]] | ||
[[ ${lines[@]} =~ "What is your user name? {Elegant Git}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --local user.name Elegant Git" ]] | ||
[[ ${lines[@]} =~ "What is your user email? {[email protected]}: " ]] | ||
[[ ${lines[@]} =~ "==>> git config --local user.email [email protected]" ]] | ||
[[ ! ${lines[@]} =~ "Please specify a command to start the editor. {vi}: " ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local core.editor vi" ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local core.commentChar |" ]] | ||
[[ ${lines[@]} =~ "1 Elegant Git aliases were removed." ]] | ||
[[ ! ${lines[@]} =~ "==>> git config --local alias.acquire-repository elegant acquire-repository" ]] | ||
} | ||
|
||
@test "'acquire-repository': configures a signature if GPG key is provided" { | ||
|
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
Oops, something went wrong.