xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Simple/lib/ok.pm (revision 3d61058aa5c692477b6d18acfbbdb653a9930ff9)
1b8851fccSafresh1package ok;
2*3d61058aSafresh1our $VERSION = '1.302199';
3b8851fccSafresh1
4b8851fccSafresh1use strict;
5b8851fccSafresh1use Test::More ();
6b8851fccSafresh1
7b8851fccSafresh1sub import {
8b8851fccSafresh1    shift;
9b8851fccSafresh1
10b8851fccSafresh1    if (@_) {
11b8851fccSafresh1        goto &Test::More::pass if $_[0] eq 'ok';
12b8851fccSafresh1        goto &Test::More::use_ok;
13b8851fccSafresh1    }
14b8851fccSafresh1
15b8851fccSafresh1    # No argument list - croak as if we are prototyped like use_ok()
16b8851fccSafresh1    my (undef, $file, $line) = caller();
17b8851fccSafresh1    ($file =~ /^\(eval/) or die "Not enough arguments for 'use ok' at $file line $line\n";
18b8851fccSafresh1}
19b8851fccSafresh1
20b8851fccSafresh1
21b8851fccSafresh1__END__
22b8851fccSafresh1
235759b3d2Safresh1=encoding UTF-8
245759b3d2Safresh1
25b8851fccSafresh1=head1 NAME
26b8851fccSafresh1
27b8851fccSafresh1ok - Alternative to Test::More::use_ok
28b8851fccSafresh1
29b8851fccSafresh1=head1 SYNOPSIS
30b8851fccSafresh1
31b8851fccSafresh1    use ok 'Some::Module';
32b8851fccSafresh1
33b8851fccSafresh1=head1 DESCRIPTION
34b8851fccSafresh1
35b8851fccSafresh1With this module, simply change all C<use_ok> in test scripts to C<use ok>,
36b8851fccSafresh1and they will be executed at C<BEGIN> time.
37b8851fccSafresh1
38b8851fccSafresh1Please see L<Test::use::ok> for the full description.
39b8851fccSafresh1
40b8851fccSafresh1=head1 CC0 1.0 Universal
41b8851fccSafresh1
42b8851fccSafresh1To the extent possible under law, 唐鳳 has waived all copyright and related
43*3d61058aSafresh1or neighboring rights to L<Test::use::ok>.
44b8851fccSafresh1
45b8851fccSafresh1This work is published from Taiwan.
46b8851fccSafresh1
47*3d61058aSafresh1L<https://creativecommons.org/publicdomain/zero/1.0/>
48b8851fccSafresh1
49b8851fccSafresh1=cut
50