In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b1c96fce6c54beaec02dbeee42970beb56299347?hp=2f445b24d1fcccfa186e5ac8cd8f82a820c4369d>
- Log ----------------------------------------------------------------- commit b1c96fce6c54beaec02dbeee42970beb56299347 Author: James E Keenan <[email protected]> Date: Sun Dec 2 09:07:40 2012 -0500 Have each test print out its description. Accomplished by modifying the hard-coded 'print ok'-type statements. (These tests were written in too idiosyncratic a manner to make conversion to t/test.pl simple. Correct order of files in MANIFEST. See: RT #115838 M MANIFEST M t/op/sprintf.t commit 8e7b23703b052410f0a5c87c7c5863840ec8f3d3 Author: James E Keenan <[email protected]> Date: Sun Dec 2 08:45:43 2012 -0500 Add or amplify inline comments as to placement of file in t/opbasic. For RT #115838 M t/opbasic/arith.t M t/opbasic/cmp.t M t/opbasic/concat.t M t/opbasic/magic_phase.t M t/opbasic/qq.t commit bb52f720b393a99bfdff2d2303fb399ef97473a6 Author: James E Keenan <[email protected]> Date: Sun Dec 2 08:25:42 2012 -0500 Adjust MANIFEST, Makefiles, test harnesses, documentation, etc., aware of new directory t/opbasic. For RT #115838 M MANIFEST M Makefile.SH M pod/perlhack.pod M pod/perlsource.pod M t/TEST M t/harness M t/run/dtrace.t M win32/Makefile commit 8a5eedb005f7c37f37bea546d40741b5a9ccfad2 Author: James E Keenan <[email protected]> Date: Sun Dec 2 08:11:13 2012 -0500 Create subdirectory t/opbasic. Move 5 test files there. t/opbasic will hold files formerly held in t/op but which, unlike the vast majority of tests in the latter directory, are ineligible to use t/test.pl as a source of test functions. Affected files: arith.t cmp.t concat.t magic_phase.t qq.t This commit does nothing more than create the new subdirectory and move the files into it. For: RT #115838 D t/op/arith.t D t/op/cmp.t D t/op/concat.t D t/op/magic_phase.t D t/op/qq.t A t/opbasic/arith.t A t/opbasic/cmp.t A t/opbasic/concat.t A t/opbasic/magic_phase.t A t/opbasic/qq.t ----------------------------------------------------------------------- Summary of changes: MANIFEST | 10 +++++----- Makefile.SH | 4 ++-- pod/perlhack.pod | 11 +++++------ pod/perlsource.pod | 7 +++++++ t/TEST | 2 +- t/harness | 2 +- t/op/sprintf.t | 16 ++++++++-------- t/{op => opbasic}/arith.t | 4 ++++ t/{op => opbasic}/cmp.t | 8 ++++++-- t/{op => opbasic}/concat.t | 6 +++++- t/{op => opbasic}/magic_phase.t | 5 +++-- t/{op => opbasic}/qq.t | 5 ++++- t/run/dtrace.t | 2 +- win32/Makefile | 2 +- 14 files changed, 53 insertions(+), 31 deletions(-) rename t/{op => opbasic}/arith.t (98%) rename t/{op => opbasic}/cmp.t (95%) rename t/{op => opbasic}/concat.t (93%) rename t/{op => opbasic}/magic_phase.t (77%) rename t/{op => opbasic}/qq.t (89%) diff --git a/MANIFEST b/MANIFEST index 4d6473d..032b1b6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5235,7 +5235,6 @@ t/op/alarm.t See if alarm works t/op/anonsub.t See if anonymous subroutines work t/op/append.t See if . works t/op/args.t See if operations on @_ work -t/op/arith.t See if arithmetic works t/op/array_base.t Tests for the remnant of $[ t/op/array.t See if array operations work t/op/assignwarn.t See if OP= operators warn correctly for undef targets @@ -5243,6 +5242,11 @@ t/op/attrhand.t See if attribute handlers work t/op/attrs.t See if attributes on declarations work t/op/auto.t See if autoincrement et all work t/op/avhv.t See if pseudo-hashes work +t/opbasic/arith.t See if arithmetic works +t/opbasic/cmp.t See if the various string and numeric compare work +t/opbasic/concat.t See if string concatenation works +t/opbasic/magic_phase.t See if ${^GLOBAL_PHASE} works +t/opbasic/qq.t See if qq works t/op/bless.t See if bless works t/op/blocks.t See if BEGIN and friends work t/op/bop.t See if bitops work @@ -5254,9 +5258,7 @@ t/op/chop.t See if chop works t/op/chr.t See if chr works t/op/closure.t See if closures work t/op/closure_test.pl Extra file for closure.t -t/op/cmp.t See if the various string and numeric compare work t/op/concat2.t Tests too complex for concat.t -t/op/concat.t See if string concatenation works t/op/cond.t See if conditional expressions work t/op/context.t See if context propagation works t/op/coreamp.t Test &foo() calls for CORE subs @@ -5327,7 +5329,6 @@ t/op/lock.t Tests for lock args & retval (no threads) t/op/loopctl.t See if next/last/redo work t/op/lop.t See if logical operators work t/op/magic-27839.t Test for #27839, skipped for minitest -t/op/magic_phase.t See if ${^GLOBAL_PHASE} works t/op/magic.t See if magic variables work t/op/method.t See if method calls work t/op/mkdir.t See if mkdir works @@ -5350,7 +5351,6 @@ t/op/print.t See if print works t/op/protowarn.t See if the illegalproto warnings work t/op/push.t See if push and pop work t/op/pwent.t See if getpw*() functions work -t/op/qq.t See if qq works t/op/qr.t See if qr works t/op/quotemeta.t See if quotemeta works t/op/rand.t See if rand works diff --git a/Makefile.SH b/Makefile.SH index 8fa9f5f..220bf70 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -1454,7 +1454,7 @@ test.torture torturetest: test_prep minitest.utf16: minitest.prep - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \ - && $(RUN_PERL) TEST -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty + && $(RUN_PERL) TEST -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t opbasic/*.t op/*.t uni/*.t </dev/tty test.utf16 check.utf16: test_prep TEST_ARGS=-utf16 $(RUN_TESTS) choose @@ -1523,7 +1523,7 @@ minitest.prep: # is crashing. minitest: $(MINIPERL_EXE) minitest.prep - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \ - && $(RUN_PERL) TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t op/*.t uni/*.t </dev/tty + && $(RUN_PERL) TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t </dev/tty # Test via harness diff --git a/pod/perlhack.pod b/pod/perlhack.pod index 0385676..8332e6e 100644 --- a/pod/perlhack.pod +++ b/pod/perlhack.pod @@ -708,20 +708,19 @@ Protocol|http://testanything.org>. =over 4 -=item * F<t/base> and F<t/comp> +=item * F<t/base>, F<t/comp> and F<t/opbasic> Since we don't know if require works, or even subroutines, use ad hoc -tests for these two. Step carefully to avoid using the feature being -tested. +tests for these three. Step carefully to avoid using the feature being +tested. Tests in F<t/opbasic>, for instance, have been placed there rather +than in F<t/op> because they test functionality which F<t/test.pl> presumes +has already been demonstrated to work. =item * F<t/cmd>, F<t/run>, F<t/io> and F<t/op> Now that basic require() and subroutines are tested, you can use the F<t/test.pl> library. -Note, however, that some test scripts still avoid F<t/test.pl> if they test -features that F<t/test.pl> relies on heavily. - You can also use certain libraries like Config conditionally, but be sure to skip the test gracefully if it's not there. diff --git a/pod/perlsource.pod b/pod/perlsource.pod index 16252eb..81e3e94 100644 --- a/pod/perlsource.pod +++ b/pod/perlsource.pod @@ -116,6 +116,13 @@ Tests for perl's method resolution order implementations (see L<mro>). Tests for perl's built in functions that don't fit into any of the other directories. +=item * F<t/opbasic/> + +Tests for perl's built in functions which, like those in F<t/op/>, do not fit +into any of the other directories, but which, in addition, cannot use +F<t/test.pl>,as that program depends on functionality which the +test file itself is testing. + =item * F<t/re/> Tests for regex related functions or behaviour. (These used to live in diff --git a/t/TEST b/t/TEST index 0ea518d..00d8159 100755 --- a/t/TEST +++ b/t/TEST @@ -430,7 +430,7 @@ unless (@ARGV) { # then comp, to validate that require works # then run, to validate that -M works # then we know we can -MTestInit for everything else, making life simpler - foreach my $dir (qw(base comp run cmd io re op uni mro)) { + foreach my $dir (qw(base comp run cmd io re opbasic op uni mro)) { _find_tests($dir); } unless ($::core) { diff --git a/t/harness b/t/harness index 1a1efdb..4f7070f 100644 --- a/t/harness +++ b/t/harness @@ -131,7 +131,7 @@ if (@ARGV) { unless (@tests) { my @seq = <base/*.t>; - my @next = qw(comp run cmd io re op uni mro lib porting); + my @next = qw(comp run cmd io re opbasic op uni mro lib porting); push @next, 'japh' if $torture; push @next, 'win32' if $^O eq 'MSWin32'; push @next, 'benchmark' if $ENV{PERL_BENCHMARK}; diff --git a/t/op/sprintf.t b/t/op/sprintf.t index 767e5cb..ca07032 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -43,7 +43,7 @@ while (<DATA>) { if ($Is_VMS_VAX || $Is_Ultrix_VAX) { # VAX DEC C 5.3 at least since there is no # ccflags =~ /float=ieee/ on VAX. - # AXP is unaffected whether or not it's using ieee. + # AXP is unaffected whether or not it is using ieee. $data =~ s/([eE])96$/${1}26/; # smaller exponents $result =~ s/([eE]\+)102$/${1}32/; # " " $data =~ s/([eE])\-101$/${1}-24/; # larger exponents @@ -105,7 +105,7 @@ for ($i = 1; @tests; $i++) { } elsif ($os =~ /\b$^O(?::(\S+))?\b/i) { my $vsn = defined $1 ? $1 : "0"; # Only compare on the the first pair of digits, as numeric - # compares don't like 2.6.10-3mdksmp or 2.6.8-24.10-default + # compares do not like 2.6.10-3mdksmp or 2.6.8-24.10-default s/^(\d+(\.\d+)?).*/$1/ for $osv, $vsn; $skip = $vsn ? ($osv <= $vsn ? 1 : 0) : 1; } @@ -113,27 +113,27 @@ for ($i = 1; @tests; $i++) { } if ($x eq ">$result<") { - print "ok $i\n"; + print "ok $i - >$result<\n"; } elsif ($skip) { - print "ok $i # skip $comment\n"; + print "ok $i - # skip $comment\n"; } elsif ($y eq ">$result<") # Some C libraries always give { # three-digit exponent - print("ok $i # >$result< $x three-digit exponent accepted\n"); + print("ok $i - # >$result< $x three-digit exponent accepted\n"); } elsif ($result =~ /[-+]\d{3}$/ && # Suppress tests with modulo of exponent >= 100 on platforms - # which can't handle such magnitudes (or where we can't tell). + # which cannot handle such magnitudes (or where we cannot tell). ((!eval {require POSIX}) || # Costly: only do this if we must! (length(&POSIX::DBL_MAX) - rindex(&POSIX::DBL_MAX, '+')) == 3)) { - print("ok $i # >$template< >$data< >$result<", + print("ok $i - # >$template< >$data< >$result<", " Suppressed: exponent out of range?\n"); } else { $y = ($x eq $y ? "" : " => $y"); - print("not ok $i >$template< >$data< >$result< $x$y", + print("not ok $i - >$template< >$data< >$result< $x$y", $comment ? " # $comment\n" : "\n"); } } diff --git a/t/op/arith.t b/t/opbasic/arith.t similarity index 98% rename from t/op/arith.t rename to t/opbasic/arith.t index 3c91971..d85a9ba 100644 --- a/t/op/arith.t +++ b/t/opbasic/arith.t @@ -5,6 +5,10 @@ BEGIN { @INC = '../lib'; } +# This file has been placed in t/opbasic to indicate that it should not use +# functions imported from t/test.pl or Test::More, as those programs/libraries +# use operators which are what is being tested in this file. + print "1..167\n"; sub try ($$$) { diff --git a/t/op/cmp.t b/t/opbasic/cmp.t similarity index 95% rename from t/op/cmp.t rename to t/opbasic/cmp.t index 0fbca5f..43e4345 100644 --- a/t/op/cmp.t +++ b/t/opbasic/cmp.t @@ -5,7 +5,11 @@ BEGIN { @INC = '../lib'; } -# 2s complement assumption. Won't break test, just makes the internals of +# This file has been placed in t/opbasic to indicate that it should not use +# functions imported from t/test.pl or Test::More, as those programs/libraries +# use operators which are what is being tested in this file. + +# 2s complement assumption. Will not break test, just makes the internals of # the SVs less interesting if were not on 2s complement system. my $uv_max = ~0; my $uv_maxm1 = ~0 ^ 1; @@ -55,7 +59,7 @@ print "1..$expect\n"; my $bad_NaN = 0; { - # gcc's -ffast-math option may stop NaNs working correctly + # gcc -ffast-math option may stop NaNs working correctly use Config; my $ccflags = $Config{ccflags} // ''; $bad_NaN = 1 if $ccflags =~ /-ffast-math\b/; diff --git a/t/op/concat.t b/t/opbasic/concat.t similarity index 93% rename from t/op/concat.t rename to t/opbasic/concat.t index e2e2c66..f020992 100644 --- a/t/op/concat.t +++ b/t/opbasic/concat.t @@ -5,7 +5,11 @@ BEGIN { @INC = '../lib'; } -# This ok() function is specially written to avoid any concatenation. +# ok() functions from other sources (e.g., t/test.pl) may use concatenation, +# but that is what is being tested in this file. Hence, we place this file +# in the directory where do not use t/test.pl, and we write an ok() function +# specially written to avoid any concatenation. + my $test = 1; sub ok { my($ok, $name) = @_; diff --git a/t/op/magic_phase.t b/t/opbasic/magic_phase.t similarity index 77% rename from t/op/magic_phase.t rename to t/opbasic/magic_phase.t index 07b4c19..d721705 100644 --- a/t/op/magic_phase.t +++ b/t/opbasic/magic_phase.t @@ -5,8 +5,9 @@ use warnings; # Test ${^GLOBAL_PHASE} # -# Test::More, test.pl, etc assert plans in END, which happens before global -# destruction, so we don't want to use those here. +# Test::More, t/test.pl, etc., assert plans in END, which happens before global +# destruction. We do not want to use those programs/libraries here, so we +# place this file in directory t/opbasic. BEGIN { print "1..7\n" } diff --git a/t/op/qq.t b/t/opbasic/qq.t similarity index 89% rename from t/op/qq.t rename to t/opbasic/qq.t index 3d1bfac..8dac6ec 100644 --- a/t/op/qq.t +++ b/t/opbasic/qq.t @@ -5,6 +5,9 @@ BEGIN { @INC = '../lib'; } +# This file uses a specially crafted is() function rather than that found in +# t/test.pl or Test::More. Hence, we place this file in directory t/opbasic. + print q(1..28 ); @@ -20,7 +23,7 @@ sub is { } foreach ($left, $right) { # Comment out these regexps to map non-printables to ord if the perl under - # test is so broken that it's not helping + # test is so broken that it is not helping s/([^-+A-Za-z_0-9])/sprintf q{'.chr(%d).'}, ord $1/ge; $_ = sprintf q('%s'), $_; s/^''\.//; diff --git a/t/run/dtrace.t b/t/run/dtrace.t index 2fa27a3..49bda66 100644 --- a/t/run/dtrace.t +++ b/t/run/dtrace.t @@ -62,7 +62,7 @@ dtrace_like( 'phase changes of a simple script', ); -# this code taken from t/op/magic_phase.t which tests all of the +# this code taken from t/opbasic/magic_phase.t which tests all of the # transitions of ${^GLOBAL_PHASE}. instead of printing (which will # interact nondeterministically with the DTrace output), we increment # an unused variable for side effects diff --git a/win32/Makefile b/win32/Makefile index 2c3d52d..b5728fe 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -1307,7 +1307,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils $(UNIDATAFILES) $(XCOPY) $(GLOBEXE) ..\t\$(NULL) attrib -r ..\t\*.* cd ..\t && \ - $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t + $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t test-prep : all utils ../pod/perltoc.pod $(XCOPY) $(PERLEXE) ..\t\$(NULL) -- Perl5 Master Repository
