Dpkg_Build_Types.t 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 => 26;
  18. BEGIN {
  19. use_ok('Dpkg::Build::Types');
  20. }
  21. ok(build_is(BUILD_DEFAULT | BUILD_FULL), 'build is default full');
  22. is(get_build_options_from_type(), 'full', 'build is full');
  23. set_build_type(BUILD_DEFAULT | BUILD_BINARY, '--default-binary');
  24. is(get_build_options_from_type(), 'binary', 'build is binary');
  25. ok(build_is(BUILD_DEFAULT | BUILD_BINARY), 'build is default binary');
  26. set_build_type(BUILD_SOURCE | BUILD_ARCH_INDEP, '--build=source,all');
  27. is(get_build_options_from_type(), 'source,all', 'build is source,all');
  28. set_build_type_from_options('any,all', '--build=any,all', nocheck => 1);
  29. is(get_build_options_from_type(), 'binary', 'build is binary from any,all');
  30. ok(build_is(BUILD_BINARY), 'build is any,all');
  31. set_build_type_from_options('binary', '--build=binary', nocheck => 1);
  32. is(get_build_options_from_type(), 'binary', 'build is binary');
  33. ok(build_is(BUILD_BINARY), 'build is binary');
  34. set_build_type_from_options('source,all', '--build=source,all', nocheck => 1);
  35. ok(build_is(BUILD_SOURCE | BUILD_ARCH_INDEP), 'build source,all is source,all');
  36. ok(!build_is(BUILD_SOURCE | BUILD_ARCH_DEP), 'build source,all is not source,any');
  37. ok(build_has_any(BUILD_SOURCE), 'build source,all has_any source');
  38. ok(build_has_any(BUILD_ARCH_INDEP), 'build source,all has_any any');
  39. ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default');
  40. ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any');
  41. ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary');
  42. ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP),
  43. 'build source,all not has_all source,any');
  44. ok(!build_has_all(BUILD_FULL), 'build source,all has_all full');
  45. set_build_type(BUILD_BINARY, '--build=binary', nocheck => 1);
  46. ok(build_is(BUILD_BINARY), 'build binary is binary');
  47. ok(build_has_any(BUILD_ARCH_DEP), 'build binary has_any any');
  48. ok(build_has_any(BUILD_ARCH_INDEP), 'build binary has_any all');
  49. ok(build_has_all(BUILD_BINARY), 'build binary has_all binary');
  50. ok(build_has_none(BUILD_SOURCE), 'build binary has_none source');
  51. set_build_type(BUILD_FULL, '--build=full', nocheck => 1);
  52. ok(build_has_any(BUILD_SOURCE), 'build full has_any source');
  53. ok(build_has_all(BUILD_BINARY), 'build full has_all binary');
  54. 1;