Tests are programs like any other program and thus should use strict; wherever possible. I drop strict 'refs' from time to time because it's easier and more clear (in a short script) to overwrite globs with a symbolic reference, but strict prevents me from making stupid typo errors.
If you think your script does not compile with strict in effect, theree is always eval STRING, but in your case, eval BLOCK should already be enough, as it is not a compilation/syntax error but a runtime error. I would rewrite the second test as:
my $csv2 = Text::xSV->new( filename => 'filename.txt', ... ); my $new_filename = "popularixCombined.csv"; eval { $csv2->set_filename($new_filename) }; is( $@, undef, "Changing the filename does not raise an error"); is( $csv->get_filename, $new_filename, "... and sets the new filename" + );
In reply to Re: xSV question, and general testing question.
by Corion
in thread xSV question, and general testing question.
by tphyahoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |