Added tests for additional SVN scenarios

pull/1615/head
Nils Winkler 2020-06-16 09:24:24 +02:00
parent 47f6682292
commit f933a86ff0
No known key found for this signature in database
GPG Key ID: 317C6E70C88A89B1
2 changed files with 63 additions and 0 deletions

View File

@ -1,3 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# If the info command is called
# AND the parent folder contains the .svn folder
# THEN return the current path, similar to what `svn info` does
if [[ "$1" = "info" ]] && [[ -d "../.svn" ]]; then
echo "$PWD"
fi
exit 0 exit 0

View File

@ -64,6 +64,43 @@ reset_svn_path() {
reset_svn_path reset_svn_path
} }
@test 'themes base: SVN: detect SVN repo even from a subfolder' {
repo="$(setup_repo)"
pushd "$repo"
mkdir foo
pushd foo
setup_svn_path "$BASH_IT/test/fixtures/svn/working"
# Load the base theme again so that the working SVN script is detected
load ../../themes/base.theme
scm
# Make sure that the SVN command is used
assert_equal "$SCM" "$SCM_SVN"
reset_svn_path
}
@test 'themes base: SVN: no SCM if no .svn folder can be found' {
repo="$(setup_repo)"
pushd "$repo"
rm -rf .svn
setup_svn_path "$BASH_IT/test/fixtures/svn/working"
# Load the base theme again so that the working SVN script is detected
load ../../themes/base.theme
scm
# Make sure that the SVN command is used
assert_equal "$SCM" "$SCM_NONE"
reset_svn_path
}
@test 'themes base: SVN: ignore SVN repo when using broken SVN command' { @test 'themes base: SVN: ignore SVN repo when using broken SVN command' {
repo="$(setup_repo)" repo="$(setup_repo)"
pushd "$repo" pushd "$repo"
@ -79,3 +116,22 @@ reset_svn_path() {
reset_svn_path reset_svn_path
} }
@test 'themes base: SVN: ignore SVN repo even from a subfolder when using a broken SVN' {
repo="$(setup_repo)"
pushd "$repo"
mkdir foo
pushd foo
setup_svn_path "$BASH_IT/test/fixtures/svn/broken"
# Load the base theme again so that the working SVN script is detected
load ../../themes/base.theme
scm
# Make sure that the SVN command is used
assert_equal "$SCM" "$SCM_NONE"
reset_svn_path
}