Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_ok not works with versions #17

Closed
schwern opened this issue May 27, 2010 · 2 comments
Closed

use_ok not works with versions #17

schwern opened this issue May 27, 2010 · 2 comments
Labels

Comments

@schwern
Copy link
Contributor

schwern commented May 27, 2010

  • GC-ID: 55
  • GC-Labels: Type-Defect, Priority-Medium
  • GC-Status: Accepted
  • GC-Attachments: No

I have problem with version in use_ok:

use_ok (module, 1.0.0);
use_ok (module, v1.0.0);

after quick look in source codes (Test::More, version 0.94) following fix
comes to my mind (change line 816 with it):

$imports[0] = join '.', unpack 'U*', $imports[0]
if 'VSTRING' eq ref \ $imports[0];

if( @imports == 1 and $imports[0] =~ /^\d+(?:.\d+)*$/ ) {


Could you please show the output you got and what you expected? I think I know what
you're talking about, but I'd like to be sure.



for given examples i expect that use_ok use version check, same like perl do.

now, Test::More use import with arguments.

See also http://www.perlmonks.org/?node_id=809447


@rjbs
Copy link
Contributor

rjbs commented Sep 27, 2013

A problem here is that perl can identify that something is a version by its literal form in the source code. That is:

use Some::Module 1.2;
use Some::Other "1.2";
use Some::Again (1.2);

In the first case, it is a version check for 1.2. In the second and third cases, an import request. use_ok can't determine this, because by the time it gets its @_, it's a variable that could be either.

I do not believe this can be made to do what you want.

@exodist
Copy link
Member

exodist commented Oct 30, 2014

closing. Not going to change use_ok at this point, use_ok is now discouraged and lots of upstream things break if we change it.

@exodist exodist closed this as completed Oct 30, 2014
exodist added a commit that referenced this issue Apr 21, 2016
exodist added a commit that referenced this issue Apr 22, 2016
    - RC1
    - Merge Test2 into the Test-Simple dist
    - Remove experimental status
    - Update copyright dates
    - Better error messages when using Carp in Hashbase init()
    - Document 2 methods on Events
    - Fix Test2 #17 (typo fix in docs)
    - Report version mismatches between Test::Builder and Test2
    - Update transition docs
    - Breakage library and warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants