[pkg-perl-tools] 03/04: Add a test for Debian::PkgPerl::Patch

Alex Muntada alexm-guest at moszumanska.debian.org
Fri Dec 2 21:42:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

alexm-guest pushed a commit to branch master
in repository pkg-perl-tools.

commit 2e3a21fdb6758e76156f8862aab7949f98968a3a
Author: Alex Muntada <alexm at alexm.org>
Date:   Fri Dec 2 22:30:28 2016 +0100

    Add a test for Debian::PkgPerl::Patch
---
 t/dummy.txt.patch |  4 ++++
 t/patch.t         | 29 +++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/t/dummy.txt.patch b/t/dummy.txt.patch
index 459a405..f9c2f2d 100644
--- a/t/dummy.txt.patch
+++ b/t/dummy.txt.patch
@@ -1,3 +1,7 @@
+Description: This is a dummy patch for testing
+Author: Alex Muntada <alexm at alexm.org>
+Forwarded: no
+
 diff --git a/dummy.txt b/dummy.txt
 index a5304af..358fe0a 100644
 --- a/dummy.txt
diff --git a/t/patch.t b/t/patch.t
new file mode 100644
index 0000000..6d61168
--- /dev/null
+++ b/t/patch.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+    plan skip_all
+        => "Set AUTHOR_TESTING and DPT_PACKAGES to perform these tests"
+        unless $ENV{AUTHOR_TESTING}
+        and -d $ENV{DPT_PACKAGES};;
+
+    plan skip_all
+        => "These tests require a working Debian::PkgPerl::Patch"
+        unless eval { use Debian::PkgPerl::Patch; 1 };
+}
+
+my $patch = "$ENV{DPT_PACKAGES}/pkg-perl-tools/t/dummy.txt.patch";
+my $bug = new_ok( 'Debian::PkgPerl::Patch', [ patch => $patch ] );
+
+my %info = $bug->retrieve_patch_info();
+ok( exists $info{Subject}, "retrieve patch info" );
+like( $info{Subject}, qr/\w+/, "subject in patch is not empty" );
+note("Subject: $info{Subject}");
+like( $info{From}, qr/\w+/, "from in patch is not empty" );
+note("From: $info{From}");
+
+done_testing();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



More information about the Pkg-perl-cvs-commits mailing list