summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Bandera <claudio.bandera@kit.edu>2015-08-30 23:04:16 +0200
committerClaudio Bandera <claudio.bandera@kit.edu>2015-08-30 23:04:16 +0200
commit2dbf0c220fc971c9493392a70c71954001fee7fd (patch)
treed846e08eb68b1aa69bb49d070d75cb4b7641b038
parentda76c7dcbc9b52e881c864c7014dbf2a0aaf43b5 (diff)
downloadgit-sonar-2dbf0c220fc971c9493392a70c71954001fee7fd.tar.gz
git-sonar-2dbf0c220fc971c9493392a70c71954001fee7fd.zip
Fixed unittests for Ubuntu
Diffstat (limited to '')
-rwxr-xr-xradar-base.sh2
-rwxr-xr-xtest-branches.sh3
-rwxr-xr-xtest-commits.sh8
-rwxr-xr-xtest-directories.sh4
-rwxr-xr-xtest-files.sh51
-rwxr-xr-xtest-status.sh1
6 files changed, 36 insertions, 33 deletions
diff --git a/radar-base.sh b/radar-base.sh
index b7074d8..8d18fe3 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -62,7 +62,7 @@ record_timestamp() {
timestamp() {
if is_repo; then
- printf '%s' "$(stat -f%m "$(dot_git)/lastupdatetime" 2>/dev/null || printf '%s' "0")"
+ printf '%s' "$(stat -c %Y "$(dot_git)/lastupdatetime" 2>/dev/null || printf '%s' "0")"
fi
}
diff --git a/test-branches.sh b/test-branches.sh
index c886e82..b972a25 100755
--- a/test-branches.sh
+++ b/test-branches.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
scriptDir="$(cd "$(dirname "$0")"; pwd)"
source "$scriptDir/radar-base.sh"
@@ -94,7 +95,7 @@ test_remote_branch_name_quiet_when_not_in_repo() {
echo "$debug_output"
- assertEquals " 0" "$usages"
+ assertEquals "0" "$usages"
rm_tmp
}
diff --git a/test-commits.sh b/test-commits.sh
index 95addf9..89a1ba1 100755
--- a/test-commits.sh
+++ b/test-commits.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
scriptDir="$(cd "$(dirname "$0")"; pwd)"
source "$scriptDir/radar-base.sh"
@@ -14,7 +15,6 @@ rm_tmp() {
cd $scriptDir
rm -rf /tmp/git-prompt-tests*
}
-
test_commits_with_no_commits() {
cd_to_tmp
git init --quiet
@@ -222,7 +222,6 @@ test_remote_branch_starts_with_local_branch_name() {
rm_tmp
}
-
test_remote_branch_ends_with_local_branch_name() {
cd_to_tmp "remote"
git init --bare --quiet
@@ -297,11 +296,10 @@ test_dont_call_remote_branch_name() {
usages="$(echo "$debug_output" | grep 'remote_branch_name' | wc -l )"
#wc -l has a weird output
- assertEquals " 0" "$usages"
+ assertEquals "0" "$usages"
rm_tmp
}
-
test_dont_remote_if_remote_is_master() {
cd_to_tmp
git init --quiet
@@ -322,7 +320,7 @@ test_dont_remote_if_remote_is_master() {
usages="$(echo "$debug_output" | grep 'git rev-list' | wc -l )"
- assertEquals " 0" "$usages"
+ assertEquals "0" "$usages"
rm_tmp
}
diff --git a/test-directories.sh b/test-directories.sh
index 86a441e..83c408f 100755
--- a/test-directories.sh
+++ b/test-directories.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
scriptDir="$(cd "$(dirname "$0")"; pwd)"
source "$scriptDir/radar-base.sh"
@@ -63,7 +64,8 @@ test_record_timestamp_in_repo() {
test_time_to_update_when_timestamp_is_old() {
cd $scriptDir
- touch -A "-010000" "$(dot_git)/lastupdatetime"
+ newtimestamp=$(date -d "now -1 hour" +%Y%m%d%H%M)
+ touch -t $newtimestamp "$(dot_git)/lastupdatetime"
assertTrue time_to_update
}
diff --git a/test-files.sh b/test-files.sh
index 8f46edf..47d6922 100755
--- a/test-files.sh
+++ b/test-files.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
scriptDir="$(cd "$(dirname "$0")"; pwd)"
source "$scriptDir/radar-base.sh"
@@ -24,7 +25,7 @@ test_untracked_files() {
touch foo
assertEquals "1A" "$(untracked_status)"
- git add .
+ git add --all
assertEquals "" "$(untracked_status)"
rm_tmp
@@ -38,7 +39,7 @@ test_unstaged_modified_files() {
touch foo
touch bar
- git add .
+ git add --all
git commit -m "foo and bar" >/dev/null
echo "foo" >> foo
@@ -58,7 +59,7 @@ test_unstaged_deleted_files() {
touch foo
touch bar
- git add .
+ git add --all
git commit -m "foo and bar" >/dev/null
rm foo
@@ -77,11 +78,11 @@ test_staged_added_files() {
assertEquals "" "$(staged_status)"
touch foo
- git add .
+ git add --all
assertEquals "1A" "$(staged_status)"
touch bar
- git add .
+ git add --all
assertEquals "2A" "$(staged_status)"
rm_tmp
@@ -95,15 +96,15 @@ test_staged_modified_files() {
touch foo
touch bar
- git add .
+ git add --all
git commit -m "foo and bar" >/dev/null
echo "foo" >> foo
- git add .
+ git add --all
assertEquals "1M" "$(staged_status)"
echo "bar" >> bar
- git add .
+ git add --all
assertEquals "2M" "$(staged_status)"
rm_tmp
@@ -117,15 +118,15 @@ test_staged_deleted_files() {
touch foo
touch bar
- git add .
+ git add --all
git commit -m "foo and bar" >/dev/null
rm foo
- git add .
+ git add --all
assertEquals "1D" "$(staged_status)"
rm bar
- git add .
+ git add --all
assertEquals "2D" "$(staged_status)"
rm_tmp
@@ -139,15 +140,15 @@ test_staged_renamed_files() {
touch foo
touch bar
- git add .
+ git add --all
git commit -m "foo and bar" >/dev/null
mv foo foo2
- git add .
+ git add --all
assertEquals "1R" "$(staged_status)"
mv bar bar2
- git add .
+ git add --all
assertEquals "2R" "$(staged_status)"
rm_tmp
@@ -159,17 +160,17 @@ test_conflicted_both_changes() {
git checkout -b foo --quiet
echo "foo" >> foo
- git add .
+ git add --all
git commit -m "foo" --quiet
git checkout -b foo2 --quiet
echo "bar" >> foo
- git add .
+ git add --all
git commit -m "bar" --quiet
git checkout foo --quiet
echo "foo2" >> foo
- git add .
+ git add --all
git commit -m "foo2" --quiet
assertEquals "" "$(conflicted_status)"
@@ -187,17 +188,17 @@ test_conflicted_them_changes() {
git checkout -b foo --quiet
echo "foo" >> foo
- git add .
+ git add --all
git commit -m "foo" --quiet
git checkout -b foo2 --quiet
rm foo
- git add .
+ git add --all
git commit -m "delete foo" --quiet
git checkout foo --quiet
echo "foo2" >> foo
- git add .
+ git add --all
git commit -m "foo2" --quiet
assertEquals "" "$(conflicted_status)"
@@ -215,17 +216,17 @@ test_conflicted_us_changes() {
git checkout -b foo --quiet
echo "foo" >> foo
- git add .
+ git add --all
git commit -m "foo" --quiet
git checkout -b foo2 --quiet
echo "bar" >> foo
- git add .
+ git add --all
git commit -m "bar" --quiet
git checkout foo --quiet
rm foo
- git add .
+ git add --all
git commit -m "delete foo" --quiet
assertEquals "" "$(conflicted_status)"
@@ -254,7 +255,7 @@ test_is_dirty() {
cd ../
- git add .
+ git add --all
assertTrue "staged addition files" is_dirty
git commit -m "inital commit" --quiet
@@ -264,7 +265,7 @@ test_is_dirty() {
echo "foo" >> foo
assertTrue "modified file unstaged" is_dirty
- git add .
+ git add --all
assertTrue "modified file staged" is_dirty
rm_tmp
diff --git a/test-status.sh b/test-status.sh
index 8c6bf89..99aebdf 100755
--- a/test-status.sh
+++ b/test-status.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
scriptDir="$(cd "$(dirname "$0")"; pwd)"
source "$scriptDir/radar-base.sh"