Skip to content

Commit

Permalink
Update test Docker image
Browse files Browse the repository at this point in the history
Status test was broken
Discovered a couple of places quotes were needed to handle spaces
  • Loading branch information
admorgan committed Dec 22, 2023
1 parent ab434e8 commit 90deb36
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ INSTALL_EXT ?= $(INSTALL_LIB)/$(NAME).d
INSTALL_MAN1 ?= $(DESTDIR)$(PREFIX)/share/man/man1

# Docker variables:
DOCKER_TAG ?= 0.0.4
DOCKER_TAG ?= 0.0.5
DOCKER_IMAGE := ingy/bash-testing:$(DOCKER_TAG)
BASH_VERSIONS ?= 5.1 5.0 4.4 4.3 4.2 4.1 4.0
DOCKER_TESTS := $(BASH_VERSIONS:%=docker-test-%)
GIT_VERSIONS := 2.29 2.25 2.17 2.7

prove ?=
test ?= test/
bash ?= 5.0
bash ?= 5.1
git ?= 2.29

# Basic targets:
Expand Down
6 changes: 3 additions & 3 deletions lib/git-subrepo
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ main() {
# Run the command on all subrepos
local args=( "${command_arguments[@]}" )
get-all-subrepos
for subdir in ${subrepos[*]}; do
for subdir in "${subrepos[@]}"; do
command-prepare
subrepo_remote=
subrepo_branch=
Expand Down Expand Up @@ -1245,11 +1245,11 @@ get-params() {
if [[ $i -ge $num ]]; then
usage-error "Command '$command' requires arg '${arg#+}'."
fi
printf -v ${arg#+} -- "$value"
printf -v "${arg#+}" -- "$value"
# Look for function name after ':' to provide a default value
else
if [[ $i -lt $num ]]; then
printf -v ${arg%:*} -- "$value"
printf -v "${arg%:*}" -- "$value"
elif [[ $arg =~ : ]]; then
"${arg#*:}"
fi
Expand Down
2 changes: 1 addition & 1 deletion share/enable-completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [[ -n ${BASH_VERSION-} ]]; then
# If a file is found at the location being checked…
if [[ -f $f ]]; then
# …source it.
source $f
source "$f"
[[ $(type -t __gitcomp) != function ]] &&
echo "WARNING: Git completion script '$f' does not provide a '__gitcomp' function"
# Proceed to loading our Bash completion facilities.
Expand Down
1 change: 1 addition & 0 deletions test/push-force.t
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ test-exists \
"$OWNER/bar/Bar2" \
"$OWNER/bar/Foo1" \


# Test that a fresh repo is not contaminated
(
git clone "$UPSTREAM/bar" "$OWNER/newbar"
Expand Down
55 changes: 29 additions & 26 deletions test/status.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ use Test::More
clone-foo-and-bar

(
cd $OWNER/foo
git subrepo clone ../../../$UPSTREAM/bar
git subrepo clone ../../../$UPSTREAM/foo bar/foo
cd "$OWNER"/foo
git subrepo clone "$UPSTREAM"/bar
git subrepo clone "$UPSTREAM"/foo bar/foo
mkdir lib
git subrepo clone ../../../$UPSTREAM/bar lib/bar
git subrepo clone ../../../$UPSTREAM/foo lib/bar/foo
git subrepo clone "$UPSTREAM"/bar lib/bar
git subrepo clone "$UPSTREAM"/foo lib/bar/foo
) &> /dev/null || die

{
output=$(
cd $OWNER/foo
git subrepo status
cd "$OWNER"/foo
git subrepo status --all
)

like "$output" "2 subrepos:" \
Expand All @@ -41,43 +41,46 @@ clone-foo-and-bar

{
output=$(
cd $OWNER/foo
git subrepo status --all-recursive
cd "$OWNER"/foo
git subrepo status --ALL
)

like "$output" "4 subrepos:" \
"'status --ALL' intro ok"

like "$output" "Git subrepo 'ext/bashplus':" \
"ext/bashplus is in 'status --ALL'"
like "$output" "Git subrepo 'bar':" \
"bar is in 'status --ALL'"

like "$output" "Git subrepo 'ext/test-more-bash':" \
"ext/test-more-bash is in 'status --ALL'"
like "$output" "Git subrepo 'lib/bar':" \
"lib/bar is in 'status --ALL'"

like "$output" "Git subrepo 'ext/test-more-bash/ext/bashplus':" \
"ext/test-more-bash/ext/bashplus is in 'status --ALL'"
like "$output" "Git subrepo 'bar/foo':" \
"bar/foo is in 'status --ALL'"

like "$output" "Git subrepo 'ext/test-more-bash/ext/test-tap-bash':" \
"ext/test-more-bash/ext/test-tap-bash is in 'status --ALL'"
like "$output" "Git subrepo 'lib/bar/foo':" \
"lib/bar/foo is in 'status --ALL'"
}

{
output=$(git subrepo status --all)
output=$(
cd "$OWNER"/foo
git subrepo status --all
)

like "$output" "2 subrepos:" \
"'status --all' intro ok"

like "$output" "Git subrepo 'ext/bashplus':" \
"ext/bashplus is in 'status --all'"
like "$output" "Git subrepo 'bar':" \
"bar is in 'status --all'"

like "$output" "Git subrepo 'ext/test-more-bash':" \
"ext/test-more-bash is in 'status --all'"
like "$output" "Git subrepo 'lib/bar':" \
"lib/bar is in 'status --all'"

unlike "$output" "Git subrepo 'ext/test-more-bash/ext/bashplus':" \
"ext/test-more-bash/ext/bashplus is not in 'status --all'"
unlike "$output" "Git subrepo 'bar/foo':" \
"bar/foo is not in 'status --all'"

unlike "$output" "Git subrepo 'ext/test-more-bash/ext/test-tap-bash':" \
"ext/test-more-bash/ext/test-tap-bash is not in 'status --all'"
unlike "$output" "Git subrepo 'lib/bar/foo':" \
"lib/bar/foo is not in 'status --all'"
}

done_testing 15
Expand Down

0 comments on commit 90deb36

Please sign in to comment.