diff options
| author | Claudio Bandera <claudio.bandera@kit.edu> | 2015-08-31 00:07:46 +0200 | 
|---|---|---|
| committer | Claudio Bandera <claudio.bandera@kit.edu> | 2015-08-31 00:07:46 +0200 | 
| commit | 4a7d636bad0d03af22f440bef9bd141bfc0dc309 (patch) | |
| tree | 680e32ee630ef44341fd4651c4435a846fd86bb1 /test | |
| parent | 2cfe557beb7fec2e67ea8cd0096eeff0be14b00f (diff) | |
| download | git-sonar-4a7d636bad0d03af22f440bef9bd141bfc0dc309.tar.gz git-sonar-4a7d636bad0d03af22f440bef9bd141bfc0dc309.zip | |
Added tests for stash indicator
Diffstat (limited to '')
| -rwxr-xr-x | test | 1 | ||||
| -rwxr-xr-x | test-stash.sh | 50 | 
2 files changed, 51 insertions, 0 deletions
| @@ -5,3 +5,4 @@  ./test-branches.sh  ./test-files.sh  ./test-status.sh +./test-stash.sh
\ No newline at end of file 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 | 
