Skip Menu |

This queue is for tickets about the Test-use-ok CPAN distribution.

Report information
The Basics
Id: 78757
Status: resolved
Priority: 0/
Queue: Test-use-ok

Owner: Nobody in particular
Requestors: mschwern [...]

Bug Information
Severity: Important
Broken in: 0.02
Fixed in: (no value)

Subject: Allow "use ok;"
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1343972406-25396-6"
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 1111
Currently, "use ok" dies if given no arguments. While this makes it work like the use_ok() interface, it makes it difficult to work with because something you just want to innocently load a module. This particularly becomes a problem with "use ok 'ok'". has code to try and detect if it's being called inside use_ok(), but that code will no longer work next release. use_ok() got smarter and sets the line and file of the eval to the caller's location. No longer will caller() report /eval/ but an actual line and file. The "use ok" tests will fail next Test::More release. could maybe try to figure out if it's called inside use_ok() by looking up the stack, but that furthers an arms race that's unnecessary. "use ok;" is pretty obviously trying to load and not accidentally testing nothing. "use ok $module" is unlikely to happen, being the whole point is doing use_ok() at BEGIN time conveniently, and you can check for being passed undef if so. This patch ends that arms race and simply makes "use ok" work. I'd be happy to make a release of this module if you're done with it.
Subject: ok.patch
MIME-Version: 1.0
Content-Type: text/x-diff; name="ok.patch"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="ok.patch"
Content-Transfer-Encoding: binary
Content-Length: 693
Download ok.patch
text/x-diff 693b
diff --git a/lib/ b/lib/ index 663a944..85952ea 100644 --- a/lib/ +++ b/lib/ @@ -6,10 +6,6 @@ use Test::More (); sub import { shift; goto &Test::More::use_ok if @_; - - # No argument list - croak as if we are prototyped like use_ok() - my (undef, $file, $line) = caller(); - ($file =~ /^\(eval/) or die "Not enough arguments for 'use ok' at $file line $line\n"; } diff --git a/t/01-basic.t b/t/01-basic.t index 12997d5..2e84f2c 100644 --- a/t/01-basic.t +++ b/t/01-basic.t @@ -1,5 +1,8 @@ use strict; use Test::More tests => 3; + +use ok; # the module can be loaded without tripping an error + use ok 'strict'; use ok 'Test::More'; use ok 'ok';
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-4409-1480191917-1483.78757-0-0 [...]>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 189
Download (untitled) / with headers
text/plain 189b
use ok 'ok'; currently works. use ok; dies saying it needs an additional argument. I *think* this is reasonable behavior. If not please re-open this ticket in the Test-Simple github issues.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to