]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blob - README
This is 0.01
[perl/modules/Test-Leaner.git] / README
1 NAME
2     Test::Leaner - A slimmer Test::More for when you favor performance over
3     completeness.
4
5 VERSION
6     Version 0.01
7
8 SYNOPSIS
9         use Test::Leaner tests => 10_000;
10         for (1 .. 10_000) {
11          ...
12          is $one, 1, "checking situation $_";
13         }
14
15 DESCRIPTION
16     When profiling some Test::More-based test script that contained about 10
17     000 unit tests, I realized that 60% of the time was spent in
18     Test::Builder itself, even though every single test actually involved a
19     costly "eval STRING".
20
21     This module aims to be a partial replacement to Test::More in those
22     situations where you want to run a large number of simple tests. Its
23     functions behave the same as their Test::More counterparts, except for
24     the following differences :
25
26     *   Stringification isn't forced on the test operands. However, "ok"
27         honors 'bool' overloading, "is" and "is_deeply" honor 'eq'
28         overloading (and just that one) and "cmp_ok" honors whichever
29         overloading category corresponds to the specified operator.
30
31     *   "pass", "fail", "ok", "is", "isnt", "like", "unlike" and "cmp_ok"
32         are all guaranteed to return the truth value of the test.
33
34     *   "cmp_ok" throws an exception if the given operator isn't a valid
35         Perl binary operator (except '=' and variants). It also tests in
36         scalar context, so '..' will be treated as the flip-flop operator
37         and not the range operator.
38
39     *   The tests don't output any kind of default diagnostic in case of
40         failure ; the rationale being that if you have a large number of
41         tests and a lot of them are failing, then you don't want to be
42         flooded by diagnostics.
43
44     *   "use_ok", "require_ok", "can_ok", "isa_ok", "new_ok", "subtest",
45         "explain", "TODO" blocks and "todo_skip" are not implemented.
46
47     *   Test::Leaner depends on Scalar::Util, while Test::More does not.
48
49 FUNCTIONS
50     The following functions from Test::More are implemented and exported by
51     default.
52
53   "plan [ tests => $count | 'no_plan' | skip_all => $reason ]"
54   "skip $reason => $count"
55   "done_testing [ $count ]"
56   "ok $ok [, $desc ]"
57   "pass [ $desc ]"
58   "fail [ $desc ]"
59   "is $got, $expected [, $desc ]"
60   "isnt $got, $expected [, $desc ]"
61   "like $got, $regexp_expected [, $desc ]"
62   "unlike $got, $regexp_expected, [, $desc ]"
63   "cmp_ok $got, $op, $expected [, $desc ]"
64   "is_deeply $got, $expected [, $desc ]"
65   "diag @text"
66   "note @text"
67   "BAIL_OUT [ $desc ]"
68     Test::Leaner also provides some functions of its own, which are never
69     exported.
70
71   "tap_stream [ $fh ]"
72     Read/write accessor for the filehandle to which the tests are outputted.
73     On write, it also turns autoflush on onto $fh.
74
75     Note that it can only be used as a write accessor before you start any
76     thread, as threads::shared cannot reliably share filehandles.
77
78     Defaults to "STDOUT".
79
80   "diag_stream [ $fh ]"
81     Read/write accessor for the filehandle to which the diagnostics are
82     printed. On write, it also turns autoflush on onto $fh.
83
84     Just like "tap_stream", it can only be used as a write accessor before
85     you start any thread, as threads::shared cannot reliably share
86     filehandles.
87
88     Defaults to "STDERR".
89
90   "THREADSAFE"
91     This constant evaluates to true if and only if Test::Leaner is
92     thread-safe, i.e. when this version of "perl" is at least 5.8, has been
93     compiled with "useithreads" defined, and threads has been loaded before
94     Test::Leaner. In that case, it also needs a working threads::shared.
95
96 DEPENDENCIES
97     perl 5.6.
98
99     Exporter, Scalar::Util, Test::More.
100
101 AUTHOR
102     Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
103
104     You can contact me by mail or on "irc.perl.org" (vincent).
105
106 BUGS
107     Please report any bugs or feature requests to "bug-test-leaner at
108     rt.cpan.org", or through the web interface at
109     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Leaner>. I will be
110     notified, and then you'll automatically be notified of progress on your
111     bug as I make changes.
112
113 SUPPORT
114     You can find documentation for this module with the perldoc command.
115
116         perldoc Test::Leaner
117
118 COPYRIGHT & LICENSE
119     Copyright 2010 Vincent Pit, all rights reserved.
120
121     This program is free software; you can redistribute it and/or modify it
122     under the same terms as Perl itself.
123