This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
constant.pm: Document fully-qualified constant names
[perl5.git] / cpan / version / t / 01base.t
CommitLineData
543eec9e
JP
1#! /usr/local/perl -w
2# Before `make install' is performed this script should be runnable with
3# `make test'. After `make install' it should work as `perl test.pl'
4
5#########################
6
7use Test::More qw/no_plan/;
8
9BEGIN {
10 (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm';
11 require $coretests;
d2b110e6 12 use_ok('version', 0.9908);
543eec9e
JP
13}
14
543eec9e
JP
15BaseTests("version","new","qv");
16BaseTests("version","new","declare");
17BaseTests("version","parse", "qv");
18BaseTests("version","parse", "declare");
19
20# dummy up a redundant call to satify David Wheeler
21local $SIG{__WARN__} = sub { die $_[0] };
22eval 'use version;';
23unlike ($@, qr/^Subroutine main::declare redefined/,
24 "Only export declare once per package (to prevent redefined warnings).");
25
26# https://rt.cpan.org/Ticket/Display.html?id=47980
27my $v = eval {
28 require IO::Handle;
29 $@ = qq(Can't locate some/completely/fictitious/module.pm);
30 return IO::Handle->VERSION;
31};
32ok defined($v), 'Fix for RT #47980';
b2a8d771
JP
33
34{ # https://rt.cpan.org/Ticket/Display.html?id=81085
35 eval { version::new() };
36 like $@, qr'Usage: version::new\(class, version\)',
37 'No bus err when called as function';
38 eval { $x = 1; print version::new };
39 like $@, qr'Usage: version::new\(class, version\)',
40 'No implicit object creation when called as function';
41 eval { $x = "version"; print version::new };
42 like $@, qr'Usage: version::new\(class, version\)',
43 'No implicit object creation when called as function';
44}