[Top][All Lists]

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

Re: [PATCH] maint: refactor tests/misc/ into tests/pr/

From: Pádraig Brady
Subject: Re: [PATCH] maint: refactor tests/misc/ into tests/pr/
Date: Thu, 25 Oct 2012 12:00:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 10/25/2012 10:48 AM, Jim Meyering wrote:
Pádraig Brady wrote:
* tests/misc/ Refactor this test into ...
* tests/pr/ ... here.
* tests/ 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/       |    1 -
  tests/misc/     |   43 -------------------------------------------
  tests/pr/m-w-t-1     |    1 +
  tests/pr/m-w-t-2     |    1 +
  tests/pr/m-w-t-3     |    1 +
  tests/pr/ |    4 ++++
  6 files changed, 7 insertions(+), 44 deletions(-)
  delete mode 100755 tests/misc/
  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

Thanks.  You're right that those should be consolidated.
However, you can move the content of misc/ into
without adding those three tiny new files to version control.

To see why, some background helps.
In, you see tests (option,I/O,exit-status quadruples)
that are very concise, e.g.,

   ['1c', '+3', [\'0Ft'], [\'3-0F'], 0],

That is the old format.  Years ago, I converted nearly all of those
tests to the newer style, which is generally preferable, but in this
case, with many explicitly-named input and output files rather than
just i/o content, converting would have made the tests less readable.
Few would fit on one line.  So, instead, I wrote the loop at the end of
that file that automatically converts the old format to the new one.

However, in the case of this test, now that you know the
old-style tests have been converted to the new style, you
can simply append that lone entry to the @Tests list:

diff --git a/tests/pr/ b/tests/pr/
index f202414..c21cca3 100755
--- a/tests/pr/
+++ b/tests/pr/
@@ -451,6 +451,13 @@ foreach my $t (@tv)
      push @Tests, $new_ent;

+push @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"} ];
  @Tests = triple_test address@hidden;

  my $save_temps = $ENV{DEBUG};

Much better.

Pushed with that adjustment.


reply via email to

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