Remove newlines in test output
diff --git a/tests/test_helpers.bash b/tests/test_helpers.bash
index 7a3d891..e604930 100644
--- a/tests/test_helpers.bash
+++ b/tests/test_helpers.bash
@@ -10,6 +10,7 @@
local expected_output=$1
shift
local actual_output=$("$@")
+ actual_output="${actual_output//[$'\t\r\n']}" # remove newlines
if ! [ "$actual_output" = "$expected_output" ]; then
echo "expected: \"$expected_output\""
echo "actual: \"$actual_output\""
diff --git a/tests/tests.bats b/tests/tests.bats
index cddd57f..d3a69a2 100644
--- a/tests/tests.bats
+++ b/tests/tests.bats
@@ -17,17 +17,15 @@
@test "test multiple JENKINS_OPTS" {
# running --help --version should return the version, not the help
local version=$(grep 'ENV JENKINS_VERSION' Dockerfile | sed -e 's/.*:-\(.*\)}/\1/')
- # need the last line of output, removing the last char
- local actual_version=$(docker run --rm -ti -e JENKINS_OPTS="--help --version" --name $SUT_CONTAINER -P $SUT_IMAGE | tail -n 1)
- assert "${version}" echo "${actual_version::-1}"
+ # need the last line of output
+ assert "${version}" docker run --rm -ti -e JENKINS_OPTS="--help --version" --name $SUT_CONTAINER -P $SUT_IMAGE | tail -n 1
}
@test "test jenkins arguments" {
# running --help --version should return the version, not the help
local version=$(grep 'ENV JENKINS_VERSION' Dockerfile | sed -e 's/.*:-\(.*\)}/\1/')
- # need the last line of output, removing the last char
- local actual_version=$(docker run --rm -ti --name $SUT_CONTAINER -P $SUT_IMAGE --help --version | tail -n 1)
- assert "${version}" echo "${actual_version::-1}"
+ # need the last line of output
+ assert "${version}" docker run --rm -ti --name $SUT_CONTAINER -P $SUT_IMAGE --help --version | tail -n 1
}
@test "create test container" {