This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix version's test scripts' $Verbose flag
[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/;
aed68192 8our $Verbose;
543eec9e
JP
9
10BEGIN {
11 (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm';
12 require $coretests;
5027b3af 13 use_ok('version', 0.9903);
543eec9e
JP
14}
15
5027b3af 16diag "Tests with base class" if $Verbose;
543eec9e
JP
17
18BaseTests("version","new","qv");
19BaseTests("version","new","declare");
20BaseTests("version","parse", "qv");
21BaseTests("version","parse", "declare");
22
23# dummy up a redundant call to satify David Wheeler
24local $SIG{__WARN__} = sub { die $_[0] };
25eval 'use version;';
26unlike ($@, qr/^Subroutine main::declare redefined/,
27 "Only export declare once per package (to prevent redefined warnings).");
28
29# https://rt.cpan.org/Ticket/Display.html?id=47980
30my $v = eval {
31 require IO::Handle;
32 $@ = qq(Can't locate some/completely/fictitious/module.pm);
33 return IO::Handle->VERSION;
34};
35ok defined($v), 'Fix for RT #47980';
b2a8d771
JP
36
37{ # https://rt.cpan.org/Ticket/Display.html?id=81085
38 eval { version::new() };
39 like $@, qr'Usage: version::new\(class, version\)',
40 'No bus err when called as function';
41 eval { $x = 1; print version::new };
42 like $@, qr'Usage: version::new\(class, version\)',
43 'No implicit object creation when called as function';
44 eval { $x = "version"; print version::new };
45 like $@, qr'Usage: version::new\(class, version\)',
46 'No implicit object creation when called as function';
47}