1#!/usr/bin/perl 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <https://www.gnu.org/licenses/>. 15 16use strict; 17use warnings; 18 19use Test::More tests => 8; 20 21BEGIN { 22 use_ok('Dpkg::BuildProfiles', qw(parse_build_profiles 23 set_build_profiles 24 get_build_profiles)); 25} 26 27# TODO: Add actual test cases. 28 29my $formula; 30 31$formula = [ ]; 32is_deeply([ parse_build_profiles('') ], $formula, 33 'parse build profiles formula empty'); 34 35$formula = [ [ qw(nocheck) ] ]; 36is_deeply([ parse_build_profiles('<nocheck>') ], $formula, 37 'parse build profiles formula single'); 38 39$formula = [ [ qw(nocheck nodoc stage1) ] ]; 40is_deeply([ parse_build_profiles('<nocheck nodoc stage1>') ], $formula, 41 'parse build profiles formula AND'); 42 43$formula = [ [ qw(nocheck) ], [ qw(nodoc) ] ]; 44is_deeply([ parse_build_profiles('<nocheck> <nodoc>') ], $formula, 45 'parse build profiles formula OR'); 46 47$formula = [ [ qw(nocheck nodoc) ], [ qw(stage1) ] ]; 48is_deeply([ parse_build_profiles('<nocheck nodoc> <stage1>') ], $formula, 49 'parse build profiles formula AND, OR'); 50 51{ 52 local $ENV{DEB_BUILD_PROFILES} = 'cross nodoc profile.name'; 53 is_deeply([ get_build_profiles() ], [ qw(cross nodoc profile.name) ], 54 'get active build profiles from environment'); 55} 56 57set_build_profiles(qw(nocheck stage1)); 58is_deeply([ get_build_profiles() ], [ qw(nocheck stage1) ], 59 'get active build profiles explicitly set'); 60 611; 62