Jeff King <peff@xxxxxxxx> writes: >> > If we assume that "expect" is first (which is our convention but not >> > necessarily guaranteed), then I think the best logic is something like: >> > >> > if $1 is empty; then >> > bug in the test script >> > elif test_cmp_allow_empty "$@" >> > test failure >> > >> > We do not need to check $2 at all. An empty one is either irrelevant (if >> > the expectation is empty), or a test failure (because it would not match >> > the non-empty $1). >> >> ... this is indeed a better solution. I written out the cases for >> updated test_cmp to straighten out my thinking: > > I'd be OK pursuing either this line, or what you showed originally. As I do find [1] to be a real concern, I'd prefer not to flag empty input to test_cmp as special. But if we _were_ to do something, I agree that "$2 can be anything---that is the output from the potentially buggy program we are testing" is the right attitude to take. [Footnote] *1* https://public-inbox.org/git/CAM0VKjkT7fBJRie_3f4B13BHT9hp9MxRhuX5r1sogh2x7KQzbg@xxxxxxxxxxxxxx/