summaryrefslogtreecommitdiffstats
path: root/test-stash.sh
diff options
context:
space:
mode:
authorSteven Hall <Hallzy.18@gmail.com>2015-10-21 11:03:26 -0700
committerSteven Hall <Hallzy.18@gmail.com>2015-10-21 11:03:26 -0700
commit225de5490a49e92ea34326226308159e93b6b80d (patch)
tree611ef993dd3c37aeb510495ce58ddcb41563805c /test-stash.sh
parent40445543f10f4e10cc13ea8a9e4ba0a79cb200db (diff)
parent984ff133d360222906ff20f7431be9a70a212539 (diff)
downloadgit-sonar-225de5490a49e92ea34326226308159e93b6b80d.tar.gz
git-sonar-225de5490a49e92ea34326226308159e93b6b80d.zip
Merge pull request #2 from michaeldfallen/hallzy_#70
Hallzy #70
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