We have a fairly common pattern in the TAP tests where we first unlink() a
config file and then do append_conf() on it in order to rewrite it from
scratch.  There's nothing wrong with it but it's IMO not as readable as it can
be (especially when unlink and append_conf are vertically separated), and
slightly errorprone as the unlink requires one to assemble the path whereas
append_conf does that automatically (yes, I have done that exact mistake during
hacking).

To make the TAP tests more readable I propose a utility function which combines
these two operations, replace_conf().  It works just like how unlink() together
with append_conf() does but in fewer and more readable lines of code.  I chose
replace rather than rewrite since it IMO more clearly signals that nothing in
the file is kept.

--
Daniel Gustafsson

Attachment: 0001-Add-replace_conf-test-utility-function.patch
Description: Binary data

Reply via email to