Add tests for classes with a range of names (#51)

This commit is contained in:
Tim Byrne 2017-03-25 11:32:06 -05:00
parent 5141433776
commit 297df5d231
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
2 changed files with 84 additions and 0 deletions

View File

@ -72,6 +72,22 @@ function test_alt() {
link_name="alt-override-user"
link_match="$link_name##$T_SYS.$T_HOST.custom_user"
;;
class_aaa)
link_name="alt-system"
link_match="$link_name##aaa"
;;
class_zzz)
link_name="alt-system"
link_match="$link_name##zzz"
;;
class_AAA)
link_name="alt-system"
link_match="$link_name##AAA"
;;
class_ZZZ)
link_name="alt-system"
link_match="$link_name##ZZZ"
;;
esac
dir_link_name="dir one/${link_name}"
dir_link_match="dir one/${link_match}"
@ -195,6 +211,62 @@ function test_alt() {
test_alt 'none' 'false' ''
}
@test "Command 'alt' (select class - aaa)" {
echo "
When the command 'alt' is provided
and file matches only ##CLASS - aaa
Report the linking
Verify correct file is linked
Exit with 0
"
GIT_DIR="$T_DIR_REPO" git config local.class aaa
test_alt 'class_aaa' 'false' ''
}
@test "Command 'alt' (select class - zzz)" {
echo "
When the command 'alt' is provided
and file matches only ##CLASS - zzz
Report the linking
Verify correct file is linked
Exit with 0
"
GIT_DIR="$T_DIR_REPO" git config local.class zzz
test_alt 'class_zzz' 'false' ''
}
@test "Command 'alt' (select class - AAA)" {
echo "
When the command 'alt' is provided
and file matches only ##CLASS - AAA
Report the linking
Verify correct file is linked
Exit with 0
"
GIT_DIR="$T_DIR_REPO" git config local.class AAA
test_alt 'class_AAA' 'false' ''
}
@test "Command 'alt' (select class - ZZZ)" {
echo "
When the command 'alt' is provided
and file matches only ##CLASS - ZZZ
Report the linking
Verify correct file is linked
Exit with 0
"
GIT_DIR="$T_DIR_REPO" git config local.class ZZZ
test_alt 'class_ZZZ' 'false' ''
}
@test "Command 'auto-alt' (enabled)" {
echo "
When a command possibly changes the repo

View File

@ -97,6 +97,10 @@ function create_worktree() {
"alt-system##S.H" \
"alt-system##S.H.U" \
"alt-system##$T_SYS" \
"alt-system##AAA" \
"alt-system##ZZZ" \
"alt-system##aaa" \
"alt-system##zzz" \
"alt-host##" \
"alt-host##S" \
"alt-host##S.H" \
@ -142,6 +146,14 @@ function create_worktree() {
"dir one/alt-system##S.H.U/file2" \
"dir one/alt-system##$T_SYS/file1" \
"dir one/alt-system##$T_SYS/file2" \
"dir one/alt-system##AAA/file1" \
"dir one/alt-system##AAA/file2" \
"dir one/alt-system##ZZZ/file1" \
"dir one/alt-system##ZZZ/file2" \
"dir one/alt-system##aaa/file1" \
"dir one/alt-system##aaa/file2" \
"dir one/alt-system##zzz/file1" \
"dir one/alt-system##zzz/file2" \
"dir one/alt-host##/file1" \
"dir one/alt-host##/file2" \
"dir one/alt-host##S/file1" \