test_error($code_ref)

This method runs the code with eval and returns the error. It strips off some common strings from the end of the message including any "at <file> line <number>" strings and any "(@INC contains: .*)".

test_warn($code_ref)

This method runs the code with eval and returns the warning. It strips off any "at <file> line <number>" specific part(s) from the end.