By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Assert whole values in the tests, and make the reports goldens The line-number assertions were nonsense: seven tests each picking a line out of a report and asking whether it was in a list, which says nothing about what the report contains and fails unhelpfully when it changes. They are one golden of the rendered report now. Every way a suppression can stop being relevant appears in it against the line that provoked it, and the one suppression in that module which does answer for a finding is the one absent from it. The same for the dirty example, whose two projection assertions are one golden, and for annotate, whose three byte-level assertions about one file are two goldens of the files it wrote. Those say what it does to a module: where it puts the annotation relative to an existing comment, and that the byte no UTF-8 decoder can read and the missing trailing newline both survive it. Elsewhere, whole values rather than fields: - parseAnnotation is asserted as the whole AnnotationFact, and every rejection against its exact message rather than through isLeft. - applySuppression is asserted as the whole Suppression, so each case says what the other two fields are rather than leaving them unchecked. - A clean run is one assertion against emptyReport, with only the counts that are true of a clean run too left out. - The absent-module failure is asserted by its message, which names the module. - Exit codes are exact: self-weeding is 3, not merely non-zero.