Add test for absence of file or string re #8546

Also correct the error message.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
Add reference to ticket #8521 in comment re #8546

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>