summaryrefslogtreecommitdiffstats
path: root/test-commits.sh
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2021-03-24 02:59:48 -0400
committerMalfurious <m@lfurio.us>2021-03-24 02:59:48 -0400
commita9737ee899dcfee46d8765c1b534b8c9df68cbe6 (patch)
tree2e0a68fbec1d86915e37c1db1c7768504f6e01e0 /test-commits.sh
parentfee615fe9fd3a535bd6dfd8fcf01c3dee9300b6c (diff)
parent51bd4bc64308f1eb8e1aab20d6f3280549098267 (diff)
downloadgit-sonar-a9737ee899dcfee46d8765c1b534b8c9df68cbe6.tar.gz
git-sonar-a9737ee899dcfee46d8765c1b534b8c9df68cbe6.zip
Merge branch 'hotfix/unittests' of https://github.com/cbandera/git-radar
Merge pending pull request #67 of upstream git-radar project from user cbandera. They write: This is a pull request to fix issue #38. As it turns out, some built in commands behave differently on Mac OS X and Linux. In order to run the tests on Linux, I have added switch statements at some points to call the functions with the respective syntax. Also I realized, that the tests only worked for me when I set the following options: git config --global push.default simple git config --global branch.autosetuprebase never But that's probably just because these should be the defaults. I normally have them set to something else...
Diffstat (limited to 'test-commits.sh')
-rwxr-xr-xtest-commits.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/test-commits.sh b/test-commits.sh
index 6c317f9..7634103 100755
--- a/test-commits.sh
+++ b/test-commits.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
scriptDir="$(cd "$(dirname "$0")"; pwd)"
source "$scriptDir/radar-base.sh"
@@ -14,7 +15,6 @@ rm_tmp() {
cd $scriptDir
rm -rf /tmp/git-prompt-tests*
}
-
test_commits_with_no_commits() {
cd_to_tmp
git init --quiet
@@ -222,7 +222,6 @@ test_remote_branch_starts_with_local_branch_name() {
rm_tmp
}
-
test_remote_branch_ends_with_local_branch_name() {
cd_to_tmp "remote"
git init --bare --quiet
@@ -297,11 +296,15 @@ test_dont_call_remote_branch_name() {
usages="$(echo "$debug_output" | grep 'remote_branch_name' | wc -l )"
#wc -l has a weird output
- assertEquals " 0" "$usages"
+ if [[ $OSTYPE == darwin* ]];then
+ expected=" 0"
+ else
+ expected="0"
+ fi;
+ assertEquals "$expected" "$usages"
rm_tmp
}
-
test_dont_remote_if_remote_is_master() {
cd_to_tmp
git init --quiet
@@ -322,7 +325,12 @@ test_dont_remote_if_remote_is_master() {
usages="$(echo "$debug_output" | grep 'git rev-list' | wc -l )"
- assertEquals " 0" "$usages"
+ if [[ $OSTYPE == darwin* ]];then
+ expected=" 0"
+ else
+ expected="0"
+ fi;
+ assertEquals "$expected" "$usages"
rm_tmp
}