Browse Source

Dpkg::Source::Quilt: Add minimal test case

Guillem Jover 10 years ago
parent
commit
286ba89fa5

+ 1 - 0
debian/changelog

@@ -12,6 +12,7 @@ dpkg (1.17.10) UNRELEASED; urgency=low
     - Improve C code coverage.
     - Add template test cases for most perl modules.
     - Add test cases for Dpkg::Deps OR relationships.
+    - Add minimal test case for Dpkg::Source::Quilt.
   * Fix non-security sensitive TOCTOU race in triggers database loading.
   * Fix non-security sensitive TOCTOU race in update-alternative alternative
     database loading.

+ 1 - 0
scripts/Makefile.am

@@ -269,6 +269,7 @@ test_data = \
 	t/Dpkg_Control/bogus-armor-inline.dsc \
 	t/Dpkg_Control/bogus-armor-nested.dsc \
 	t/Dpkg_Control/bogus-armor-spaces.dsc \
+	t/Dpkg_Source_Quilt/parse/debian/patches/series \
 	t/Dpkg_Substvars/substvars1 \
 	t/Dpkg_Dist_Files/files-byhand \
 	t/merge_changelogs/ch-old \

+ 12 - 1
scripts/t/Dpkg_Source_Quilt.t

@@ -16,12 +16,23 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 2;
 
 BEGIN {
     use_ok('Dpkg::Source::Quilt');
 }
 
+my $srcdir = $ENV{srcdir} || '.';
+my $datadir = $srcdir . '/t/Dpkg_Source_Quilt';
+
+my $quilt;
+my (@series_got, @series_exp);
+
+$quilt = Dpkg::Source::Quilt->new("$datadir/parse");
+@series_got = $quilt->series();
+@series_exp = qw(change-a.patch change-b.patch change-c.patch change-d.patch);
+is_deeply(\@series_got, \@series_exp, 'Parsed series file matches ref');
+
 # TODO: Add actual test cases.
 
 1;

+ 9 - 0
scripts/t/Dpkg_Source_Quilt/parse/debian/patches/series

@@ -0,0 +1,9 @@
+   # Comment-only line
+   change-a.patch     -p1
+   
+	# Blank line with comments
+	change-b.patch
+	change-c.patch	-p1
+	change-d.patch
+
+# End comment