#!/usr/bin/perl # $Id: /local/youri/soft/submit/trunk/t/tags.t 3062 2007-06-28T16:21:35.624871Z guillaume $ use Test::More tests => 7; use Test::Exception; use Youri::Package::RPM::Test; use Youri::Submit::Test::Set; my $test = Youri::Submit::Test::Set->new( skip => [ 'bar' ] ); lives_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { arch => 'noarch' }), Youri::Package::RPM::Test->new(tags => { arch => 'src', }) ] ) } 'one source and one binary package from the same source succeed'; throws_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { arch => 'src' }), Youri::Package::RPM::Test->new(tags => { arch => 'noarch', sourcerpm => 'other-1-1.src.rpm', }) ] ) } qr/not a canonical package set/, 'one source and one binary packages from different sources fails'; throws_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { arch => 'noarch' }) ] ) } qr/number of source packages < 1/, 'just one source binary fails'; throws_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { arch => 'src' }) ] ) } qr/number of binary packages < 1/, 'just one source binary fails'; throws_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { arch => 'src' }), Youri::Package::RPM::Test->new(tags => { arch => 'src' }), ] ) } qr/number of source packages > 1/, 'two source packages fails'; lives_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { arch => 'src' }), Youri::Package::RPM::Test->new(tags => { arch => 'noarch' }), Youri::Package::RPM::Test->new(tags => { arch => 'noarch' }) ] ) } 'one source and two binary packages succedd'; lives_ok { $test->run( undef, undef, undef, [ Youri::Package::RPM::Test->new(tags => { name => 'bar', release => '1mdk' }) ] ) } 'non-compliant package with exception succeed';