coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] maint: refactor tests/misc/pr.pl into tests/pr/pr-tests.pl


From: Pádraig Brady
Subject: [PATCH] maint: refactor tests/misc/pr.pl into tests/pr/pr-tests.pl
Date: Wed, 24 Oct 2012 23:23:03 +0100

* tests/misc/pr.pl: Refactor this test into ...
* tests/pr/pr-tests.pl: ... here.
* tests/local.mk: Remove the reference to the removed test
* tests/pr/m-w-t-1: Input file for the refactored test.
* tests/pr/m-w-t-2: Likewise.
* tests/pr/m-w-t-3: Likewise.
---
 tests/local.mk       |    1 -
 tests/misc/pr.pl     |   43 -------------------------------------------
 tests/pr/m-w-t-1     |    1 +
 tests/pr/m-w-t-2     |    1 +
 tests/pr/m-w-t-3     |    1 +
 tests/pr/pr-tests.pl |    4 ++++
 6 files changed, 7 insertions(+), 44 deletions(-)
 delete mode 100755 tests/misc/pr.pl
 create mode 100644 tests/pr/m-w-t-1
 create mode 100644 tests/pr/m-w-t-2
 create mode 100644 tests/pr/m-w-t-3

diff --git a/tests/local.mk b/tests/local.mk
index 5a237fa..f31c8b0 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -240,7 +240,6 @@ all_tests =                                 \
   tests/misc/od-float.sh                       \
   tests/misc/mktemp.pl                         \
   tests/misc/arch.sh                           \
-  tests/misc/pr.pl                             \
   tests/misc/join.pl                           \
   tests/pr/pr-tests.pl                         \
   tests/misc/pwd-option.sh                     \
diff --git a/tests/misc/pr.pl b/tests/misc/pr.pl
deleted file mode 100755
index 0f25e25..0000000
--- a/tests/misc/pr.pl
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/perl
-# Exercise a bug with pr -m -s
-
-# Copyright (C) 2007-2012 Free Software Foundation, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# 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 strict;
-
-(my $program_name = $0) =~ s|.*/||;
-
-$ENV{PROG} = 'pr';
-my $ME = $ENV{PROG};
-
-# Turn off localization of executable's output.
-@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
-
-my @Tests =
-  (
-   ['merge-w-tabs', '-m -s -t',
-    {IN=>{1=>"a\tb\tc\n"}},
-    {IN=>{2=>"m\tn\to\n"}},
-    {IN=>{3=>"x\ty\tz\n"}},
-     {OUT=>join("\t", qw(a b c m n o x y z)) . "\n"} ],
-  );
-
-my $save_temps = $ENV{DEBUG};
-my $verbose = $ENV{VERBOSE};
-
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
-my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
-exit $fail;
diff --git a/tests/pr/m-w-t-1 b/tests/pr/m-w-t-1
new file mode 100644
index 0000000..8e1a7a2
--- /dev/null
+++ b/tests/pr/m-w-t-1
@@ -0,0 +1 @@
+a      b       c
diff --git a/tests/pr/m-w-t-2 b/tests/pr/m-w-t-2
new file mode 100644
index 0000000..45ef271
--- /dev/null
+++ b/tests/pr/m-w-t-2
@@ -0,0 +1 @@
+m      n       o
diff --git a/tests/pr/m-w-t-3 b/tests/pr/m-w-t-3
new file mode 100644
index 0000000..e8aca8b
--- /dev/null
+++ b/tests/pr/m-w-t-3
@@ -0,0 +1 @@
+x      y       z
diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl
index f202414..b786482 100755
--- a/tests/pr/pr-tests.pl
+++ b/tests/pr/pr-tests.pl
@@ -407,6 +407,10 @@ my @tv = (
 # Before coreutils-8.13 page numbers were not handled correctly when
 # headers were not printed (when -l <= 10 or -t or -T specified)
 ['page-range', '+1:1 -2 -l1 -s" "',  "a\nb\nc\n", "a b\n", 0],
+
+# Exercise a bug with pr -m -s (commit 553d347)
+['merge-w-tabs', '-m -s -t', [\'m-w-t-1', \'m-w-t-2', \'m-w-t-3'],
+ join("\t", qw(a b c m n o x y z)) . "\n", 0],
 );
 
 # Convert the above old-style test vectors to the newer
-- 
1.7.6.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]