Explorar el Código

test: Add unit tests for dependency simplification with build profiles

Guillem Jover hace 10 años
padre
commit
883453e9f5
Se han modificado 2 ficheros con 23 adiciones y 1 borrados
  1. 1 0
      debian/changelog
  2. 22 1
      scripts/t/Dpkg_Deps.t

+ 1 - 0
debian/changelog

@@ -82,6 +82,7 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
     - Accept perl's Lancaster Consensus AUTHOR_TESTING variable.
     - Add new minimum perl version unit test.
     - Add new synopsis unit test.
+    - Add unit tests for dependency simplification with build profiles.
   * Documentation:
     - Improve dpkg-buildpackage(1) on environment expectations.
     - Clarify the format of the db:Status-Abbrev virtual field in

+ 22 - 1
scripts/t/Dpkg_Deps.t

@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 58;
+use Test::More tests => 62;
 
 use Dpkg::Arch qw(get_host_arch);
 use Dpkg::Version;
@@ -197,6 +197,27 @@ $dep_red->simplify_deps($facts, $dep_opposite);
 is($dep_red->output(), 'abc, two', 'Simplification respect order');
 is("$dep_red", $dep_red->output(), 'Stringification == output()');
 
+my $dep_profiles = deps_parse('dupe <stage1 cross>, dupe <stage1 cross>');
+$dep_profiles->simplify_deps($facts);
+is($dep_profiles->output(), 'dupe <stage1 cross>',
+   'Simplification respects duplicated profiles');
+
+$dep_profiles = deps_parse('tool <!cross>, tool <stage1 cross>');
+$dep_profiles->simplify_deps($facts);
+# XXX: Ideally this would get simplified to "tool <!cross> <stage1 cross>".
+is($dep_profiles->output(), 'tool <!cross>, tool <stage1 cross>',
+   'Simplification respects profiles');
+
+$dep_profiles = deps_parse('libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>', build_dep => 1);
+$dep_profiles->simplify_deps($facts);
+is($dep_profiles->output(),
+   'libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>',
+   'Simplification respects archqualifiers and profiles');
+
+my $dep_version = deps_parse('pkg, pkg (= 1.0)');
+$dep_version->simplify_deps($facts);
+is($dep_version->output(), 'pkg (= 1.0)', 'Simplification merges versions');
+
 my $dep_empty1 = deps_parse('');
 is($dep_empty1->output(), '', 'Empty dependency');