Skip to content

Commit

Permalink
approvals.bash: Ignore trailing CR & whitespace
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Gołaś <[email protected]>
  • Loading branch information
philipandag committed Oct 15, 2024
1 parent ac2c21e commit 6cb6139
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/approvals.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ approve() {
return
fi

if [[ "$(printf "%b" "$actual")" = "$(printf "%b" "$expected")" ]]; then
$diff_cmd <(printf "%b" "$expected\n") <(printf "%b" "$actual\n")
if [[ $? == 0 ]]; then
pass "$cmd"
else
printf -- "$changed_diff_string\n" "$cmd"
Expand Down Expand Up @@ -166,7 +167,7 @@ changed_diff_string="────┤ $(blue changed): $(bold %s) ├────
approval_string="[A]pprove? "

if diff --help | grep -- --color >/dev/null 2>&1; then
diff_cmd="diff --unified --color=always"
diff_cmd="diff --unified --strip-trailing-cr -Z --color=always"
else
diff_cmd="diff --unified"
diff_cmd="diff --unified --strip-trailing-cr -Z"
fi

0 comments on commit 6cb6139

Please sign in to comment.