Skip to content

Commit

Permalink
test: DRY up test script
Browse files Browse the repository at this point in the history
  • Loading branch information
jidicula committed Nov 7, 2021
1 parent 85428c2 commit 4604c5d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/docker-run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

FALLBACK_STYLE="llvm"
EXCLUDE_REGEX="capital"
CLANG_FORMAT_VERSION="13"
GITHUB_WORKSPACE="/test"

# build the docker container
docker build . --file Dockerfile --tag clang-format-action-test --no-cache
Expand All @@ -12,15 +14,15 @@ if [[ "$docker_status" != "0" ]]; then
fi

# should succeed
docker run -e CLANG_FORMAT_VERSION=13 -e GITHUB_WORKSPACE=/test -v "$(pwd)"/test:/test --privileged clang-format-action-test known_pass $FALLBACK_STYLE $EXCLUDE_REGEX
docker run -e CLANG_FORMAT_VERSION=$CLANG_FORMAT_VERSION -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE -v "$(pwd)"/test:/test --privileged clang-format-action-test known_pass $FALLBACK_STYLE $EXCLUDE_REGEX
docker_status="$?"
if [[ "$docker_status" != "0" ]]; then
echo "files that should succeed have failed!"
exit 1
fi

# should fail
docker run -e CLANG_FORMAT_VERSION=13 -e GITHUB_WORKSPACE=/test -v "$(pwd)"/test:/test --privileged clang-format-action-test known_fail $FALLBACK_STYLE $EXCLUDE_REGEX
docker run -e CLANG_FORMAT_VERSION=$CLANG_FORMAT_VERSION -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE -v "$(pwd)"/test:/test --privileged clang-format-action-test known_fail $FALLBACK_STYLE $EXCLUDE_REGEX
docker_status="$?"
if [[ "$docker_status" == "0" ]]; then
echo "files that should fail have succeeded!"
Expand Down

0 comments on commit 4604c5d

Please sign in to comment.