[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] Coverage for Wrap.pm.
From: |
Ralf Wildenhues |
Subject: |
[PATCH 2/5] Coverage for Wrap.pm. |
Date: |
Sun, 18 Oct 2009 17:45:02 +0200 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
* lib/Automake/tests/Wrap.pl (@tests): Add test for word with
trailing space.
(test_makefile_wrap, @makefile_tests): New function, new list of
tests, to test makefile_wrap.
Signed-off-by: Ralf Wildenhues <address@hidden>
---
ChangeLog | 6 ++++++
lib/Automake/tests/Wrap.pl | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c4841df..6ae4243 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-10-18 Ralf Wildenhues <address@hidden>
+ Coverage for Wrap.pm.
+ * lib/Automake/tests/Wrap.pl (@tests): Add test for word with
+ trailing space.
+ (test_makefile_wrap, @makefile_tests): New function, new list of
+ tests, to test makefile_wrap.
+
Coverage for Version.pm.
* lib/Automake/tests/Version.pl (test_version_compare): Also
try Automake::Version::check for the version pairs, taking into
diff --git a/lib/Automake/tests/Wrap.pl b/lib/Automake/tests/Wrap.pl
index 8d840fc..b415401 100644
--- a/lib/Automake/tests/Wrap.pl
+++ b/lib/Automake/tests/Wrap.pl
@@ -1,4 +1,4 @@
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-use Automake::Wrap 'wrap';
+use Automake::Wrap qw/wrap makefile_wrap/;
my $failed = 0;
@@ -31,6 +31,18 @@ sub test_wrap
}
}
+sub test_makefile_wrap
+{
+ my ($in, $exp_out) = @_;
+
+ my $out = &makefile_wrap (@$in);
+ if ($out ne $exp_out)
+ {
+ print STDERR "For: @$in\nGot:\n$out\nInstead of:\n$exp_out\n---\n";
+ ++$failed;
+ }
+}
+
my @tests = (
[["HEAD:", "NEXT:", "CONT", 13, "v" ,"a", "l", "ue", "s", "values"],
"HEAD:v aCONT
@@ -55,10 +67,32 @@ big continuation:diag3
"big header: END
cont: word1 END
cont: word2
+"],
+ [["big header:", "", " END", 16, "w1", "w2 ", "w3"],
+"big header: END
+w1 w2 w3
"]);
+my @makefile_tests = (
+ [["target:"],
+"target:
+"],
+ [["target:", "\t"],
+"target:
+"],
+ [["target:", "\t", "prereq1", "prereq2"],
+"target: prereq1 prereq2
+"],
+ [["target: ", "\t", "this is a long list of prerequisites ending in space",
+ "so that there is no need for another space before the backslash",
+ "unlike in the second line"],
+"target: this is a long list of prerequisites ending in space \\
+\tso that there is no need for another space before the backslash \\
+\tunlike in the second line
+"]);
test_wrap (@{$_}) foreach @tests;
+test_makefile_wrap (@{$_}) foreach @makefile_tests;
exit $failed;
--
1.6.5.1.31.gad12b