Suffix ellipses do not work after a whole-line ellipsis
emillon opened this issue · comments
Etienne Millon commented
Hi,
The following cram test does not work properly:
$ cmd
...
prefix ...
More specifically, the last line is matched literally so the following diff will be reported:
$ cmd
...
- prefix ...
+ prefix ignored part
While debugging this I discovered that there are two types of ellipses:
- whole-line ellipses, just
...
on the line (with optional whitespace around). These are parsed asEllipsis
and can match 0 or more lines. - suffix ellipses (introduced in #85): a line that ends with
...
. It is parsed asOutput s
(with...
ins
) and matching is controlled inOutput.equal
. These can only appear at the end of a line.
The bug is demonstrated in the following utop session:
utop # Mdx.Output.equal [`Output "ignored"; `Output "prefix suffix"] [`Output "ignored"; `Output "prefix ..."];;
- : bool = true
utop # Mdx.Output.equal [`Output "ignored"; `Output "prefix suffix"] [`Ellipsis; `Output "prefix ..."];;
- : bool = false
In terms of solutions, ellipses are on the way out so it does not seem fixing.
A workaround if somebody is affected consists in replacing the suffix ellipsis by a whole-line one (or use postprocessing).