]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blobdiff - README
Bump copyright year
[perl/modules/Test-Leaner.git] / README
diff --git a/README b/README
index 8bdc1f5483e428751ef1a53bd2332f5ab9986853..c888a55a762542b8c7ccde6a15162c9a50e0d1f7 100644 (file)
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ NAME
     completeness.
 
 VERSION
-    Version 0.01
+    Version 0.05
 
 SYNOPSIS
         use Test::Leaner tests => 10_000;
@@ -25,50 +25,153 @@ DESCRIPTION
 
     *   Stringification isn't forced on the test operands. However, "ok"
         honors 'bool' overloading, "is" and "is_deeply" honor 'eq'
-        overloading (and just that one) and "cmp_ok" honors whichever
-        overloading category corresponds to the specified operator.
+        overloading (and just that one), "isnt" honors 'ne' overloading, and
+        "cmp_ok" honors whichever overloading category corresponds to the
+        specified operator.
 
-    *   "pass", "fail", "ok", "is", "isnt", "like", "unlike" and "cmp_ok"
-        are all guaranteed to return the truth value of the test.
+    *   "pass", "fail", "ok", "is", "isnt", "like", "unlike", "cmp_ok" and
+        "is_deeply" are all guaranteed to return the truth value of the
+        test.
+
+    *   "isn't" (the sub "t" in package "isn") is not aliased to "isnt".
+
+    *   "like" and "unlike" don't special case regular expressions that are
+        passed as '/.../' strings. A string regexp argument is always
+        treated as the source of the regexp, making "like $text, $rx" and
+        "like $text, qr[$rx]" equivalent to each other and to "cmp_ok $text,
+        '=~', $rx" (and likewise for "unlike").
 
     *   "cmp_ok" throws an exception if the given operator isn't a valid
         Perl binary operator (except '=' and variants). It also tests in
         scalar context, so '..' will be treated as the flip-flop operator
         and not the range operator.
 
+    *   "is_deeply" doesn't guard for memory cycles. If the two first
+        arguments present parallel memory cycles, the test may result in an
+        infinite loop.
+
     *   The tests don't output any kind of default diagnostic in case of
         failure ; the rationale being that if you have a large number of
         tests and a lot of them are failing, then you don't want to be
-        flooded by diagnostics.
+        flooded by diagnostics. Moreover, this allows a much faster variant
+        of "is_deeply".
 
     *   "use_ok", "require_ok", "can_ok", "isa_ok", "new_ok", "subtest",
         "explain", "TODO" blocks and "todo_skip" are not implemented.
 
-    *   Test::Leaner depends on Scalar::Util, while Test::More does not.
+ENVIRONMENT
+  "PERL_TEST_LEANER_USES_TEST_MORE"
+    If this environment variable is set, Test::Leaner will replace its
+    functions by those from Test::More. Moreover, the symbols that are
+    imported when you "use Test::Leaner" will be those from Test::More, but
+    you can still only import the symbols originally defined in Test::Leaner
+    (hence the functions from Test::More that are not implemented in
+    Test::Leaner will not be imported). If your version of Test::More is too
+    old and doesn't have some symbols (like "note" or "done_testing"), they
+    will be replaced in Test::Leaner by croaking stubs.
+
+    This may be useful if your Test::Leaner-based test script fails and you
+    want extra diagnostics.
 
 FUNCTIONS
     The following functions from Test::More are implemented and exported by
     default.
 
-  "plan [ tests => $count | 'no_plan' | skip_all => $reason ]"
-  "skip $reason => $count"
-  "done_testing [ $count ]"
-  "ok $ok [, $desc ]"
-  "pass [ $desc ]"
-  "fail [ $desc ]"
-  "is $got, $expected [, $desc ]"
-  "isnt $got, $expected [, $desc ]"
-  "like $got, $regexp_expected [, $desc ]"
-  "unlike $got, $regexp_expected, [, $desc ]"
-  "cmp_ok $got, $op, $expected [, $desc ]"
-  "is_deeply $got, $expected [, $desc ]"
-  "diag @text"
-  "note @text"
-  "BAIL_OUT [ $desc ]"
+  "plan"
+        plan tests => $count;
+        plan 'no_plan';
+        plan skip_all => $reason;
+
+    See "plan" in Test::More.
+
+  "skip"
+        skip $reason => $count;
+
+    See "skip" in Test::More.
+
+  "done_testing"
+        done_testing;
+        done_testing $count;
+
+    See "done_testing" in Test::More.
+
+  "ok"
+        ok $ok;
+        ok $ok, $desc;
+
+    See "ok" in Test::More.
+
+  "pass"
+        pass;
+        pass $desc;
+
+    See "pass" in Test::More.
+
+  "fail"
+        fail;
+        fail $desc;
+
+    See "fail" in Test::More.
+
+  "is"
+        is $got, $expected;
+        is $got, $expected, $desc;
+
+    See "is" in Test::More.
+
+  "isnt"
+        isnt $got, $expected;
+        isnt $got, $expected, $desc;
+
+    See "isnt" in Test::More.
+
+  "like"
+        like $got, $regexp_expected;
+        like $got, $regexp_expected, $desc;
+
+    See "like" in Test::More.
+
+  "unlike"
+        unlike $got, $regexp_expected;
+        unlike $got, $regexp_expected, $desc;
+
+    See "unlike" in Test::More.
+
+  "cmp_ok"
+        cmp_ok $got, $op, $expected;
+        cmp_ok $got, $op, $expected, $desc;
+
+    See "cmp_ok" in Test::More.
+
+  "is_deeply"
+        is_deeply $got, $expected;
+        is_deeply $got, $expected, $desc;
+
+    See "is_deeply" in Test::More.
+
+  "diag"
+        diag @lines;
+
+    See "diag" in Test::More.
+
+  "note"
+        note @lines;
+
+    See "note" in Test::More.
+
+  "BAIL_OUT"
+        BAIL_OUT;
+        BAIL_OUT $desc;
+
+    See "BAIL_OUT" in Test::More.
+
     Test::Leaner also provides some functions of its own, which are never
     exported.
 
-  "tap_stream [ $fh ]"
+  "tap_stream"
+        my $tap_fh = tap_stream;
+        tap_stream $fh;
+
     Read/write accessor for the filehandle to which the tests are outputted.
     On write, it also turns autoflush on onto $fh.
 
@@ -77,7 +180,10 @@ FUNCTIONS
 
     Defaults to "STDOUT".
 
-  "diag_stream [ $fh ]"
+  "diag_stream"
+        my $diag_fh = diag_stream;
+        diag_stream $fh;
+
     Read/write accessor for the filehandle to which the diagnostics are
     printed. On write, it also turns autoflush on onto $fh.
 
@@ -96,7 +202,7 @@ FUNCTIONS
 DEPENDENCIES
     perl 5.6.
 
-    Exporter, Scalar::Util, Test::More.
+    Exporter, Test::More.
 
 AUTHOR
     Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
@@ -116,7 +222,15 @@ SUPPORT
         perldoc Test::Leaner
 
 COPYRIGHT & LICENSE
-    Copyright 2010 Vincent Pit, all rights reserved.
+    Copyright 2010,2011,2013 Vincent Pit, all rights reserved.
+
+    This program is free software; you can redistribute it and/or modify it
+    under the same terms as Perl itself.
+
+    Except for the fallback implementation of the internal "_reftype"
+    function, which has been taken from Scalar::Util and is
+
+    Copyright 1997-2007 Graham Barr, all rights reserved.
 
     This program is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself.