summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-09-16 15:15:33 +0100
committerMichael Allen <michael@michaelallen.io>2015-09-16 15:15:33 +0100
commit131d04ea52fa194d8e027e495ca3b46e4b36f0ae (patch)
tree07c1f3ff8e07c8c583378530a3155c916cc660bc
parent2c0be1e2fd311a5fd18726b44be1a0ff8ae823e4 (diff)
downloadgit-sonar-131d04ea52fa194d8e027e495ca3b46e4b36f0ae.tar.gz
git-sonar-131d04ea52fa194d8e027e495ca3b46e4b36f0ae.zip
Test the new functions directly
Diffstat (limited to '')
-rwxr-xr-xtest-branches.sh1
-rwxr-xr-xtest-colors.sh7
-rwxr-xr-xtest-commits.sh5
3 files changed, 13 insertions, 0 deletions
diff --git a/test-branches.sh b/test-branches.sh
index f380a2d..5c33d23 100755
--- a/test-branches.sh
+++ b/test-branches.sh
@@ -56,6 +56,7 @@ test_detached_from_branch() {
assertEquals "$sha" "$(branch_ref)"
assertEquals "detached@$sha" "$(zsh_readable_branch_name)"
assertEquals "detached@$sha" "$(bash_readable_branch_name)"
+ assertEquals "detached@$sha" "$(readable_branch_name)"
rm_tmp
}
diff --git a/test-colors.sh b/test-colors.sh
index 59a8704..73c20f7 100755
--- a/test-colors.sh
+++ b/test-colors.sh
@@ -293,12 +293,14 @@ test_bash_colors_local() {
printf -v expected " 1\x01local-ahead\x02↑\x01local-reset\x02"
assertEquals "$expected" "$(bash_color_local_commits)"
+ assertEquals "$expected" "$(color_local_commits)"
git push --quiet >/dev/null
git reset --hard head^ --quiet >/dev/null
printf -v expected " 1\x01local-behind\x02↓\x01local-reset\x02"
assertEquals "$expected" "$(bash_color_local_commits)"
+ assertEquals "$expected" "$(color_local_commits)"
echo "foo" > foo
git add .
@@ -306,6 +308,7 @@ test_bash_colors_local() {
printf -v expected " 1\x01local-diverged\x02⇵\x01local-reset\x021"
assertEquals "$expected" "$(bash_color_local_commits)"
+ assertEquals "$expected" "$(color_local_commits)"
rm_tmp
}
@@ -379,6 +382,7 @@ test_bash_colors_remote() {
printf -v expected "m 1 \x01remote-behind\x02→\x01remote-reset\x02 "
assertEquals "$expected" "$(bash_color_remote_commits)"
+ assertEquals "$expected" "$(color_remote_commits)"
echo "bar" > bar
git add .
@@ -387,12 +391,14 @@ test_bash_colors_remote() {
printf -v expected "m 1 \x01remote-diverged\x02⇄\x01remote-reset\x02 1 "
assertEquals "$expected" "$(bash_color_remote_commits)"
+ assertEquals "$expected" "$(color_remote_commits)"
git pull origin master --quiet >/dev/null
git push --quiet >/dev/null
printf -v expected "m \x01remote-ahead\x02←\x01remote-reset\x02 2 "
assertEquals "$expected" "$(bash_color_remote_commits)"
+ assertEquals "$expected" "$(color_remote_commits)"
rm_tmp
}
@@ -459,6 +465,7 @@ test_bash_colors_changes() {
printf -v expected " $staged $unstaged $untracked"
assertEquals "$expected" "$(bash_color_changes_status)"
+ assertEquals "$expected" "$(color_changes_status)"
rm_tmp
}
diff --git a/test-commits.sh b/test-commits.sh
index 8aa2da2..1a4a86c 100755
--- a/test-commits.sh
+++ b/test-commits.sh
@@ -378,6 +378,7 @@ test_local_commits() {
assertEquals "" "$(zsh_color_local_commits)"
assertEquals "" "$(bash_color_local_commits)"
+ assertEquals "" "$(color_local_commits)"
git init --quiet
touch README
@@ -394,6 +395,7 @@ test_local_commits() {
assertEquals "" "$(zsh_color_local_commits)"
assertEquals "" "$(bash_color_local_commits)"
+ assertEquals "" "$(color_local_commits)"
cd "$repo"
echo "bar" > bar
@@ -402,6 +404,7 @@ test_local_commits() {
assertEquals " 1$up" "$(zsh_color_local_commits)"
assertEquals " 1$up" "$(bash_color_local_commits)"
+ assertEquals " 1$up" "$(color_local_commits)"
cd "$remote"
echo "foo" > foo
@@ -413,11 +416,13 @@ test_local_commits() {
assertEquals " 1${both}1" "$(zsh_color_local_commits)"
assertEquals " 1${both}1" "$(bash_color_local_commits)"
+ assertEquals " 1${both}1" "$(color_local_commits)"
git reset --hard HEAD^ --quiet
assertEquals " 1$down" "$(zsh_color_local_commits)"
assertEquals " 1$down" "$(bash_color_local_commits)"
+ assertEquals " 1$down" "$(color_local_commits)"
}
. ./shunit/shunit2