1Test::Stream::Workflow:U:sUenritC(o3n)tributed Perl DocuTmeesntt:a:tSitorneam::Workflow::Unit(3)
2
3
4
6 Test::Stream::Workflow::Unit - Representation of a workflow unit.
7
9 "This module is still EXPERIMENTAL". Test-Stream is now stable, but
10 this particular module is still experimental. You are still free to use
11 this module, but you have been warned that it may change in backwords
12 incompatible ways. This message will be removed from this modules POD
13 once it is considered stable.
14
16 This distribution is deprecated in favor of Test2, Test2::Suite, and
17 Test2::Workflow.
18
19 See Test::Stream::Manual::ToTest2 for a conversion guide.
20
22 This package is a single unit of work to be done in a workflow. The
23 unit may contain a codeblock, or many child units.
24
26 $bool = $unit->contains($name)
27 $bool = $unit->contains($line)
28 $bool = $unit->contains("$file $line)
29 Check if the unit contains (or is) a unit with the given
30 specification. The specification may be a line number, a filename +
31 line number, or a unit name. This will return true if either the
32 unit, or one of the child units, matches.
33
34 $unit->add_modify($other_unit)
35 $unit->add_buildup($other_unit)
36 $unit->add_teardown($other_unit)
37 These add $other_unit as a child unit. The child is added to the
38 group specified in the method name.
39
40 $unit->add_primary($other_unit)
41 Add a primary unit child. Note: The primary unit is either an
42 arrayref of other units, or a single coderef. In cases where the
43 primary is a coderef, this will fail badly.
44
45 $unit->add_post(sub { ... })
46 Add a post-build callback.
47
48 $unit->do_post()
49 Run (and remove) the post-build callbacks.
50
51 $dbg = $unit->debug
52 Generate an Test::Stream::Debug object for this unit.
53
54 $ctx = $unit->context
55 Generate a context representing the scope of the unit. Note: this
56 context is non-canonical.
57
58 $name = $unit->name
59 Get the unit name.
60
61 $hr = $unit->meta
62 Get the meta hashref, this contains things like 'todo' and 'skip'.
63
64 $type = $unit->type
65 Get the unit type.
66
67 $bool = $unit->wrap
68 True if the codeblock for this unit is a wrap (around_all,
69 around_each, etc).
70
71 $hr = $unit->stash
72 General purpose stash for use in plugins and extensions.
73
74 $pkg = $unit->package
75 Package for the unit.
76
77 $file = $unit->file
78 Filename for the unit
79
80 $start = $unit->start_line
81 Starting line for the unit.
82
83 $end = $unit->end_line
84 Ending line number for the unit. Note: This can be set to an
85 integer, or to the string 'EOF'.
86
87 $unit->adjust_lines
88 This will check all child unit bounds, if they fall outside the
89 parents bounds then the parent will be adjusted.
90
91 $ar = $unit->post
92 $ar = $unit->modify
93 $ar = $unit->buildup
94 $ar = $unit->teardown
95 Access to the arrayrefs for the specific child types.
96
97 $code_or_ar = $unit->primary
98 Get the primary, which may be an arrayref of other units, or a
99 single coderef.
100
102 The source code repository for Test::Stream can be found at
103 http://github.com/Test-More/Test-Stream/.
104
106 Chad Granum <exodist@cpan.org>
107
109 Chad Granum <exodist@cpan.org>
110
112 Copyright 2015 Chad Granum <exodist7@gmail.com>.
113
114 This program is free software; you can redistribute it and/or modify it
115 under the same terms as Perl itself.
116
117 See http://dev.perl.org/licenses/
118
119
120
121perl v5.32.0 2020-07-28 Test::Stream::Workflow::Unit(3)