1Test2::Tools::Defer(3)User Contributed Perl DocumentationTest2::Tools::Defer(3)
2
3
4

NAME

6       Test2::Tools::Defer - Write tests that get executed at a later time
7

DESCRIPTION

9       Sometimes you need to test things BEFORE loading the necessary
10       functions. This module lets you do that. You can write tests, and then
11       have them run later, after "Test2" is loaded. You tell it what test
12       function to run, and what arguments to give it.  The function name and
13       arguments will be stored to be executed later. When ready, run
14       "do_def()" to kick them off once the functions are defined.
15

SYNOPSIS

17           use strict;
18           use warnings;
19
20           use Test2::Tools::Defer;
21
22           BEGIN {
23               def ok => (1, 'pass');
24               def is => ('foo', 'foo', 'runs is');
25               ...
26           }
27
28           use Test2::Tools::Basic;
29
30           do_def(); # Run the tests
31
32           # Declare some more tests to run later:
33           def ok => (1, "another pass");
34           ...
35
36           do_def(); # run the new tests
37
38           done_testing;
39

EXPORTS

41       def function => @args;
42           This will store the function name, and the arguments to be run
43           later. Note that each package has a separate store of tests to run.
44
45       do_def()
46           This will run all the stored tests. It will also reset the list to
47           be empty so you can add more tests to run even later.
48

SOURCE

50       The source code repository for Test2-Suite can be found at
51       https://github.com/Test-More/Test2-Suite/.
52

MAINTAINERS

54       Chad Granum <exodist@cpan.org>
55

AUTHORS

57       Chad Granum <exodist@cpan.org>
58
60       Copyright 2018 Chad Granum <exodist@cpan.org>.
61
62       This program is free software; you can redistribute it and/or modify it
63       under the same terms as Perl itself.
64
65       See http://dev.perl.org/licenses/
66
67
68
69perl v5.28.1                      2018-12-04            Test2::Tools::Defer(3)
Impressum