Skip to content

Commit

Permalink
Avoid the need for diff --strip-trailing-cr in Windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Jan 29, 2025
1 parent f61019d commit 75a3071
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# Flags also need Unix line endings (see https://github.com/gbdev/rgbds/issues/955)
*.flags text eol=lf

# Test outputs also need Unix line endings (see https://github.com/gbdev/rgbds/pull/1635)
*.out text eol=lf
*.err text eol=lf

# Binary files need exact bytes
*.bin binary
*.gb binary
Expand Down
2 changes: 1 addition & 1 deletion test/asm/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RGBASM=../../rgbasm
RGBLINK=../../rgblink

tryDiff () {
if ! diff -au --strip-trailing-cr "$1" "$2"; then
if ! diff -au "$1" "$2"; then
echo "${bold}${red}${i%.asm}${variant}.$3 mismatch!${rescolors}${resbold}"
false
fi
Expand Down
2 changes: 1 addition & 1 deletion test/fix/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rescolors="$(tput op)"
RGBFIX=./rgbfix

tryDiff () {
if ! diff -au --strip-trailing-cr "$1" "$2"; then
if ! diff -au "$1" "$2"; then
echo "${bold}${red}${3:-$1} mismatch!${rescolors}${resbold}"
false
fi
Expand Down
4 changes: 2 additions & 2 deletions test/gfx/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ for f in *.png; do
newTest "$RGBGFX" $flags "$f"
if [[ -e "${f%.png}.err" ]]; then
runTest 2>"$errtmp"
diff -au --strip-trailing-cr "${f%.png}.err" "$errtmp" || failTest
diff -au "${f%.png}.err" "$errtmp" || failTest
else
runTest && checkOutput "${f%.png}" || failTest $?
fi

newTest "$RGBGFX" $flags - "<$f"
if [[ -e "${f%.png}.err" ]]; then
runTest 2>"$errtmp"
diff -au --strip-trailing-cr <(sed "s/$f/<stdin>/g" "${f%.png}.err") "$errtmp" || failTest
diff -au <(sed "s/$f/<stdin>/g" "${f%.png}.err") "$errtmp" || failTest
else
runTest && checkOutput "${f%.png}" || failTest $?
fi
Expand Down
2 changes: 1 addition & 1 deletion test/link/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ continueTest () {
}

tryDiff () {
if ! diff -au --strip-trailing-cr "$1" "$2"; then
if ! diff -au "$1" "$2"; then
echo "${bold}${red}$1 mismatch!${rescolors}${resbold}"
false
fi
Expand Down

0 comments on commit 75a3071

Please sign in to comment.