This was a personal comminication from me to 'Michael G Schwern'. He
dislikes the idea of adding new things, but he suggested to post my idea
to this audience.

Ahh i have an idea (patches are below),

> On Wed, Jan 08, 2003 at 12:07:43AM +0100, Murat ?nalan wrote:
> > I wanted to suggest to use MANIFEST order of *.t files (appendix),
> > instead of random. Looks like a patch to 
> ExtUtils::Command::MM would
> > do that.
> 
> They're not random, they're alphabetically sorted by filename.

Oh yes. But this, IMHO, isn't a good solution. I see all this nice
people writing CPAN modules and tests, and are unhappy because they have
to rename their *.t files. And rename it. And rename it, because they
are so lazy and stupid like me. Example

 01_setup.t.......ok
 02_install.t.....ok
 03_work.t........ok
 04_teardown.t....ok

after a week i invent "postsetup" and *baah*:

 First thought:  "How should i rename the test files?"
 Second thought: "Damn, i would need the 02_ suffix now !"  Third
thought:  "Damn, i am stupid ! Or why me ?"  Fourth thought: "No, no not
you. Blame the one who invented this alphabetically sorting for
testfiles!"  Fifth thought:  "Hmm, i have an idea. Just rename
02_install.t, 03_work.t and 04_teardown.t to"

 01_setup.t
 03_install.t
 04_work.t
 05_teardown.t

and place 02_postsetup.t into t. 

Hopefully you see what happens to me (and perhaps others) when they came
with the idea to create 'preinstall'.

So a new option in Makefile.PL like "MANIFEST_ORDERED_TESTS" => 1,
(could explicitly help the programmer) and would also be backwards
compatible to existing 'renamers' modules. And then i could simply
invent and order my *.t files (without the renaming saga) in the
MANIFEST and it DWIM.

my patches are below (BEHAVIOUR: if "MANIFEST_ORDERED_TESTS" is true in
the WriteMakeFile( .. ) call, then *.t files from the MANIFEST are taken
in
their preserved order)

Murat

ExtUtils\MakeMaker.pm

222d221
<       MANIFEST_ORDERED_TESTS

ExtUtils\MM_Any.pm

148,172d147
<                       # MUENALAN now reorder $tests if
MANIFEST_ORDER_TESTS is set
<
<       my $test_harness_name = 'test_harness';
<
<       if( exists $self->{MANIFEST_ORDERED_TESTS} )
<       {
<               if( -e 'MANIFEST' && $self->{MANIFEST_ORDERED_TESTS} )
<               {
<                       my ( %tests );
<
<                       $tests{ $_ } = 1 for split /\s/, $tests;
<
<                       if( open( MANIFEST, '<MANIFEST' ) )
<                       {
<                               my @tfiles = grep { chomp; /.\.t$/ }
<MANIFEST>;
<
<                               $tests = join ' ', @tfiles;
<
<                               warn "Ordering *.t files via
MANIFEST\n";
<
<                               $test_harness_name =
'test_harness_unsorted';
<                       }
<               }
<       }
<
174c149
<       qq{"-e" "${test_harness_name}(\$(TEST_VERBOSE), '\$(INST_LIB)',
'\$(INST_ARCHLIB)')" $tests\n};
---
>            qq{"-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)',
'\$(INST_ARCHLIB)')" $tests\n};

ExtUtils\Command\MM.pm

10c10
< @EXPORT = qw(test_harness test_harness_unsorted);
---
> @EXPORT = qw(test_harness);
46c46
< sub test_harness_unsorted {
---
> sub test_harness {
54,61c54
<     Test::Harness::runtests(@ARGV);
< }
<
< sub test_harness {
<
<     my $verbose = shift;
<
<     test_harness_unsorted( $verbose, sort { lc $a cmp lc $b } @ARGV );
---
>     Test::Harness::runtests(sort { lc $a cmp lc $b } @ARGV);

Reply via email to