Dpkg_BuildProfiles.t 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. use strict;
  16. use warnings;
  17. use Test::More tests => 8;
  18. BEGIN {
  19. use_ok('Dpkg::BuildProfiles', qw(parse_build_profiles
  20. set_build_profiles
  21. get_build_profiles));
  22. }
  23. # TODO: Add actual test cases.
  24. my $formula;
  25. $formula = [ ];
  26. is_deeply([ parse_build_profiles('') ], $formula,
  27. 'parse build profiles formula empty');
  28. $formula = [ [ qw(nocheck) ] ];
  29. is_deeply([ parse_build_profiles('<nocheck>') ], $formula,
  30. 'parse build profiles formula single');
  31. $formula = [ [ qw(nocheck nodoc stage1) ] ];
  32. is_deeply([ parse_build_profiles('<nocheck nodoc stage1>') ], $formula,
  33. 'parse build profiles formula AND');
  34. $formula = [ [ qw(nocheck) ], [ qw(nodoc) ] ];
  35. is_deeply([ parse_build_profiles('<nocheck> <nodoc>') ], $formula,
  36. 'parse build profiles formula OR');
  37. $formula = [ [ qw(nocheck nodoc) ], [ qw(stage1) ] ];
  38. is_deeply([ parse_build_profiles('<nocheck nodoc> <stage1>') ], $formula,
  39. 'parse build profiles formula AND, OR');
  40. {
  41. local $ENV{DEB_BUILD_PROFILES} = 'cross nodoc profile.name';
  42. is_deeply([ get_build_profiles() ], [ qw(cross nodoc profile.name) ],
  43. 'get active build profiles from environment');
  44. }
  45. set_build_profiles(qw(nocheck stage1));
  46. is_deeply([ get_build_profiles() ], [ qw(nocheck stage1) ],
  47. 'get active build profiles explicitly set');
  48. 1;