#!/usr/bin/env bash
# test a mostly normal patch using stdout, should not generate any QA
# given the only issue is corrected by --git/--p0p1 or is silenced
copydat normal.patch
expect -2 "Success*42.68%*meaningful." -co --git normal.patch > output1
md5cmp 591c09716414b49f19836dd0bf02f388 output1
expect -2 "Warning*38.32%*meaningful." -co --p0p1 normal.patch > output2
md5cmp d78aa50fbb205c036bb3c2aae14ce251 output2
export EDITOR="echo --" # echo the file path rather than edit
expect -2 "Success*39.57%*/normal.patch" \
	-co --quiet --edit normal.patch > output3
md5cmp 3d269f4a252dbd355d1d659514db8eeb output3
export EDITOR="sed -i -e /^/d --" # truncate into an invalid patch
expect -2 "*Warning:*unified*" \
	-co --quiet --edit normal.patch > output4
md5cmp d41d8cd98f00b204e9800998ecf8427e output4

