summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Daenney <daenney@users.noreply.github.com>2023-02-27 10:23:17 +0100
committerLibravatar GitHub <noreply@github.com>2023-02-27 10:23:17 +0100
commit6c2bd141f782a6f01d08e336300629c6b0cade1d (patch)
tree09f9661477a86972ecf097239852990f0db18d63
parent[chore]: Bump golang.org/x/oauth2 from 0.4.0 to 0.5.0 (#1564) (diff)
downloadgotosocial-6c2bd141f782a6f01d08e336300629c6b0cade1d.tar.xz
[chore] Better diff for envparsing test (#1562)
This checks if jd is availalbe and if so uses that to create the diff instead. jd can tell you at which (nested) key the values are differing which makes for more human friendly output.
-rwxr-xr-xtest/envparsing.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/envparsing.sh b/test/envparsing.sh
index 10c5cb3af..603dcadca 100755
--- a/test/envparsing.sh
+++ b/test/envparsing.sh
@@ -94,7 +94,12 @@ echo "$OUTPUT" > "$OUTPUT_OUT"
EXPECT_OUT=$(mktemp)
echo "$EXPECT" > "$EXPECT_OUT"
-if ! DIFF=$(diff "$OUTPUT_OUT" "$EXPECT_OUT"); then
+DIFFCMD=$(command -v diff 2>&1)
+if command -v jd >/dev/null 2>&1; then
+ DIFFCMD=$(command -v jd 2>&1)
+fi
+
+if ! DIFF=$("$DIFFCMD" "$OUTPUT_OUT" "$EXPECT_OUT"); then
echo "OUTPUT not equal EXPECTED"
echo "$DIFF"
exit 1