]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Coverage for Wrap.pm.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 18 Oct 2009 09:55:10 +0000 (11:55 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 18 Oct 2009 15:37:27 +0000 (17:37 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/Automake/tests/Wrap.pl

index c4841df7df14217fc503661f9b1d56f78ab83822..6ae4243b429f8aec8e856b7b562d8704cf8a83ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-10-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       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
index 8d840fc30f661051f5095169064cebfd1e93e80b..b41540150c6bca8a445952d6caf8edb760435abc 100644 (file)
@@ -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;