summaryrefslogtreecommitdiffstats
path: root/test-files.sh
blob: ee583cc9442c992d39dcbb94871911fce8f30f04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
scriptDir="$(cd "$(dirname "$0")"; pwd)"

source "$scriptDir/git-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_untracked_files() {
  cd_to_tmp
  git init --quiet

  assertEquals "0" "$(untracked_files)"
  
  touch foo
  assertEquals "1" "$(untracked_files)"

  git add .
  assertEquals "0" "$(untracked_files)"

  rm_tmp
}

. ./shunit/shunit2