Stupid Test Behavior

Ovid on 2004-09-22T20:04:18

Debugging, debugging, debugging. What's going on? I have the filename being passed at $ARGV[0], but I didn't set it. This is annoying, but I can't find what's setting that behavior. OK, let's do this methodically and see when it's getting set. The first two lines of my (xUnit style) test:

sub TEST_DATASET_CONTAINS_THE_CORRECT_FIELDS
{
    use Data::Dumper::Simple;
    warn Dumper(@ARGV);
    ...
}

Which merrily produces:

TEST_DATASET__LOOKS_GOOD ..FAILED!!
-- @ARGV = (
  'SixMonthGrossesByDMAExportRunner.pm'
);

After working here for a year, I only discover today that our in-house test harness thoughtfully and silently alters the contents of @ARGV, but naturally this behavior is not replicated by the code which runs these exports.

Update: A bit of through reveals the reason. We run our test program and pass the name of the class as the argument, but never explicitly clear @ARGV. I think a slight tweak to our test suite is in order.