diff --git a/lib/bashly/libraries/test/approvals.bash b/lib/bashly/libraries/test/approvals.bash index 011446f2..123a03d8 100644 --- a/lib/bashly/libraries/test/approvals.bash +++ b/lib/bashly/libraries/test/approvals.bash @@ -1,4 +1,4 @@ -# approvals.bash v0.3.3 +# approvals.bash v0.4.0 # # Interactive approval testing for Bash. # https://github.com/DannyBen/approvals.bash @@ -9,6 +9,10 @@ approve() { cmd=$1 last_exit_code=0 actual=$(eval "$cmd" 2>&1) || last_exit_code=$? + if [[ "$allow_diff_regex" ]]; then + actual=$(echo "$actual" | sed "s/$allow_diff_regex/*/g") + unset allow_diff_regex + fi approval=$(printf "%b" "$cmd" | tr -s -c "[:alnum:]" _) approval_file="$approvals_dir/${2:-"$approval"}" @@ -35,6 +39,10 @@ approve() { fi } +allow_diff() { + allow_diff_regex="$1" +} + describe() { echo blue "= $*"