« blib/lib/Class/MakeMethods/Utility/Inheritable.pm
↑ Summary
blib/lib/Class/MakeMethods/Template/PackageVar.pm »
| 1 | ###################################################################### | ||||||||||
| 2 | # | ||||||||||
| 3 | # Please Note: This test module is deprecated, but included for | ||||||||||
| 4 | # compatibility with some of the older tests in this distribution. | ||||||||||
| 5 | # | ||||||||||
| 6 | ###################################################################### | ||||||||||
| 7 | |||||||||||
| 8 | package Test; | ||||||||||
| 9 | |||||||||||
| 10 | # | ||||||||||
| 11 | # $Id: Test.pm,v 1.1 2000/04/26 04:29:41 recoil Exp $ | ||||||||||
| 12 | # | ||||||||||
| 13 | |||||||||||
| 14 | # COPYRIGHT NOTICE | ||||||||||
| 15 | # | ||||||||||
| 16 | # Copyright 1996 Organic Online, Inc. Title, ownership rights, and | ||||||||||
| 17 | # intellectual property rights in and to this software remain with | ||||||||||
| 18 | # Organic Online, Inc. Organic Online, Inc. hereby reserves all rights | ||||||||||
| 19 | # in and to this software. This software may not be copied, modified, | ||||||||||
| 20 | # or used without a license from Organic Online, Inc. This software is | ||||||||||
| 21 | # protected by international copyright laws and treaties, and may be | ||||||||||
| 22 | # protected by other law. Violation of copyright laws may result in | ||||||||||
| 23 | # civil liability and criminal penalties. | ||||||||||
| 24 | |||||||||||
| 25 | 35 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | 35 | ▶ | use Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 35 | ▶ | use vars qw ( @ISA @EXPORT ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | @ISA = qw ( Exporter ); | ||||||||||
| 30 | @EXPORT = qw ( TEST COUNT_TESTS PRINT_TEST_HEADER find_test ); | ||||||||||
| 31 | |||||||||||
| 32 | my $COUNTER = 0; | ||||||||||
| 33 | |||||||||||
| 34 | $| = 1; | ||||||||||
| 35 | print "1..", &COUNT_TESTS(), "\n" unless $0 =~ /^-e/; | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | sub TEST (&) { | ||||||||
|
Subroutine
TEST: not called CC=2 SCAR=17.9
| |||||||||||
| 38 | 0 | my ($code) = @_; | |||||||||
| 39 | 0 | $COUNTER++; | |||||||||
| 40 | 0 | ▶ | &$code or print "not "; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | print "ok $COUNTER\n"; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | sub COUNT_TESTS { | ||||||||||
| 45 | my ($file) = @_; | ||||||||||
| 46 | $file ||= $0; | ||||||||||
| 47 | my $c = 0; | ||||||||||
| 48 | open(IN, $file) or die "Can't open $file: $!"; | ||||||||||
| 49 | while (<IN>) { | ||||||||||
| 50 | /^\s*#/ and next; | ||||||||||
| 51 | $c += s/(TEST\s{)/$1/g; | ||||||||||
| 52 | } | ||||||||||
| 53 | $c; | ||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | sub find_test ($@) { | ||||||||||
| 57 | my ($file, @numbers) = @_; | ||||||||||
| 58 | open(T, $file) or die "Can't open $file: $!"; | ||||||||||
| 59 | local $/ = undef; | ||||||||||
| 60 | my $content = <T>; | ||||||||||
| 61 | my $c = 0; | ||||||||||
| 62 | my %tests = map { ++$c, $_ } $content =~ /\nTEST\s+{.*?};/gs; | ||||||||||
| 63 | @numbers or @numbers = (1 .. $c); | ||||||||||
| 64 | foreach (@numbers) { | ||||||||||
| 65 | print "#$_: $tests{$_}\n"; | ||||||||||
| 66 | } | ||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | 1; | ||||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||