summaryrefslogtreecommitdiffstats
path: root/test-stash.sh
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-10-16 17:07:32 +0100
committerMichael Allen <michael@michaelallen.io>2015-10-16 17:07:32 +0100
commita72cc5136a8e9f25d9b3c60922e2f390bbdfae01 (patch)
treec7a1c3241da26496cfa9148feb2d9f16308ee4ef /test-stash.sh
parentf043242a00cc9a178ffa8205462c9cd61ffe36b2 (diff)
parent127e3e5b6d9f95062c6e05e083fbda1860eb647f (diff)
downloadgit-sonar-a72cc5136a8e9f25d9b3c60922e2f390bbdfae01.tar.gz
git-sonar-a72cc5136a8e9f25d9b3c60922e2f390bbdfae01.zip
Merge pull request #80 from cbandera/feature/stash_indicator
Feature/stash indicator
Diffstat (limited to 'test-stash.sh')
-rwxr-xr-xtest-stash.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/test-stash.sh b/test-stash.sh
new file mode 100755
index 0000000..aecd83c
--- /dev/null
+++ b/test-stash.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+scriptDir="$(cd "$(dirname "$0")"; pwd)"
+
+source "$scriptDir/radar-base.sh"
+
+tmpfile=""
+
+cd_to_tmp() {
+ tmpfile="/tmp/git-prompt-tests-$(time_now)$1"
+ mkdir -p "$tmpfile"
+ cd "$tmpfile"
+}
+
+rm_tmp() {
+ cd $scriptDir
+ rm -rf /tmp/git-prompt-tests*
+}
+
+test_unstashed_status() {
+ cd_to_tmp
+ git init --quiet
+
+ assertEquals "0" "$(stashed_status)"
+
+ rm_tmp
+}
+
+test_stashed_status() {
+ cd_to_tmp
+ git init --quiet
+
+ touch foo
+ git add --all
+ git commit -m "Initial commit" >/dev/null
+ echo "test">foo
+ git stash > /dev/null
+ assertEquals "1" "$(stashed_status)"
+
+ echo "test2">foo
+ git stash > /dev/null
+ assertEquals "2" "$(stashed_status)"
+
+ git stash drop > /dev/null
+ assertEquals "1" "$(stashed_status)"
+
+
+ rm_tmp
+}
+
+. ./shunit/shunit2