Skip to content

Commit

Permalink
Hide diff when comparing files
Browse files Browse the repository at this point in the history
  • Loading branch information
gsf committed Apr 5, 2024
1 parent ddd1d01 commit 6c6154b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions optout/src/test/resources/check-conf-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ set -e

# Echo to stderr
err() {
echo 2>&1 $1
echo 2>&1 "$@"
}

conf_file=$1
today=$(date +%Y%m%d)
expected=$(mktemp)

err "Expected file content:"

# Use head from gnu coreutils to remove trailing newline
head -c-1 <<EOF > "$expected"
head -c-1 <<EOF | tee 2>&1 "$expected"
HDR_BENECONFIRM${today}
1S00E00JG37${today}NAccepted 00
7SP1D00AA00${today}NAccepted 00
Expand All @@ -24,6 +26,16 @@ DUMMY000007${today}NAccepted 00
TRL_BENECONFIRM${today}0000000007
EOF

err "Testing confirmation file"
diff -u "$conf_file" "$expected"
err "Confirmation file is formatted as expected"
# Print some newlines to make logs easier to read
err
err

err "Testing confirmation file..."

# Hide output for now to avoid revealing sensitive info
if ! diff -u "$conf_file" "$expected" > /dev/null; then
err "Confirmation file differs from expected"
exit 1
fi

err "Confirmation file matches expected"

0 comments on commit 6c6154b

Please sign in to comment.