Subject: | False positive detected when asserting an empty list |
When given a empty list, the method `assert` should fail, but it doesn't:
$self->assert( (), 'should fail' );
The workaround is to use `scalar`:
$self->assert( scalar( () ), 'should fail' );
Subject: | TestUnit.failure.pl |
#!/usr/bin/env perl
use strict;
use warnings;
use Test::Unit::HarnessUnit;
my $r = Test::Unit::HarnessUnit->new();
$r->start('MyTest');
package MyTest;
use base qw( Test::Unit::TestCase );
sub test_passes {
my ($self) = @_;
$self->assert( (), 'should fail' );
}
sub test_fails {
my ($self) = @_;
$self->assert( scalar( () ), 'should fail' );
}