Subject: | exclude_tags option |
Date: | Mon, 12 Aug 2013 21:09:28 +0200 (CEST) |
To: | bug-Test-Class-Moose [...] rt.cpan.org |
From: | "Thomas Lokajczyk" <thomas.lokajczyk [...] gmx.de> |
Hi Ovid,
I am very happy with your Test::Class::Moose module, especially the tag function is very helpful in my use case. But I found a little bug with the exclude_tags option. Here my test case:
package TestFor;
use Test::Class::Moose;
sub test_1 : Tags( ALL 001 ){
ok(1, 'Test 1')
};
sub test_2 : Tags( ALL 002 ){
ok(1, 'Test 1')
};
sub test_3 : Tags( ALL 003 ){
ok(1, 'Test 1')
};
1;
When I start this test with
use FindBin;
use lib "$FindBin::Bin/lib";
use Test::Class::Moose::Load ( 'lib/TestFor.pm', );
Test::Class::Moose->new( include_tags => ['ALL'] )->runtests;
Every thing works fine:
C:\svn\Tools\Testbox>perl run.pl
1..1
#
# Running tests for TestFor
#
1..3
# TestFor->test_1()
ok 1 - Test 1
1..1
ok 1 - test_1
# TestFor->test_2()
ok 1 - Test 1
1..1
ok 2 - test_2
# TestFor->test_3()
ok 1 - Test 1
1..1
ok 3 - test_3
ok 1 – TestFor
Now I use the exclude_tags option:
Test::Class::Moose->new( include_tags => ['ALL'],
exclude_tags => ['001'] )->runtests;
Here the result is still ok:
C:\svn\Tools\Testbox>perl run.pl
1..1
#
# Running tests for TestFor
#
1..2
# TestFor->test_2()
ok 1 - Test 1
1..1
ok 1 - test_2
# TestFor->test_3()
ok 1 - Test 1
1..1
ok 2 - test_3
ok 1 – TestFor
But when I use two tags to exclude it does not run as I would expect
Test::Class::Moose->new( include_tags => ['ALL'],
exclude_tags => ['001', '002' ] )->runtests;
C:\svn\Tools\Testbox>perl run.pl
1..1
#
# Running tests for TestFor
#
1..3
# TestFor->test_1()
ok 1 - Test 1
1..1
ok 1 - test_1
# TestFor->test_2()
ok 1 - Test 1
1..1
ok 2 - test_2
# TestFor->test_3()
ok 1 - Test 1
1..1
ok 3 - test_3
ok 1 – TestFor
The elements in the exclude_tag array are not connected with an OR but with an AND relation as you can see here
Test::Class::Moose->new( include_tags => ['ALL'],
exclude_tags => ['001', 'ALL' ] )->runtests;
C:\svn\Tools\Testbox>perl run.pl
1..1
#
# Running tests for TestFor
#
1..2
# TestFor->test_2()
ok 1 - Test 1
1..1
ok 1 - test_2
# TestFor->test_3()
ok 1 - Test 1
1..1
ok 2 - test_3
ok 1 - TestFor
I guess this behavior is not correct.
These tests where made with Test-Class-Moose-0.12 on Strawberry Perl 5.16.3.1.
I hope that you are ok with my description, it is my first bug report I wrote for a CPAN module.
Best regards
Thomas