.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test2::Manual::Testing::Todo 3pm" .TH Test2::Manual::Testing::Todo 3pm "2019-01-20" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test2::Manual::Testing::Todo \- Tutorial for marking tests as TODO. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This tutorial covers the process of marking tests as \s-1TODO.\s0 It also describes how \s-1TODO\s0 works under the hood. .SH "THE TOOL" .IX Header "THE TOOL" .Vb 1 \& use Test2::Tools::Basic qw/todo/; .Ve .SS "\s-1TODO BLOCK\s0" .IX Subsection "TODO BLOCK" This form is low-magic. All tests inside the block are marked as todo, tests outside the block are not todo. You do not need to do any variable management. The flaw with this form is that it adds a couple levels to the stack, which can break some high-magic tests. .PP Overall this is the preferred form unless you have a special case that requires the variable form. .PP .Vb 4 \& todo "Reason for the todo" => sub { \& ok(0, "fail but todo"); \& ... \& }; .Ve .SS "\s-1TODO VARIABLE\s0" .IX Subsection "TODO VARIABLE" This form maintains the todo scope for the life of the variable. This is useful for tests that are sensitive to scope changes. This closely emulates the Test::More style which localized the \f(CW$TODO\fR package variable. Once the variable is destroyed (set it to undef, scope end, etc) the \s-1TODO\s0 state ends. .PP .Vb 4 \& my $todo = todo "Reason for the todo"; \& ok(0, "fail but todo"); \& ... \& $todo = undef; .Ve .SH "MANUAL TODO EVENTS" .IX Header "MANUAL TODO EVENTS" .Vb 1 \& use Test2::API qw/context/; \& \& sub todo_ok { \& my ($bool, $name, $todo) = @_; \& \& my $ctx = context(); \& $ctx\->send_event(\*(AqOk\*(Aq, pass => $bool, effective_pass => 1, todo => $todo); \& $ctx\->release; \& \& return $bool; \& } .Ve .PP The Test2::Event::Ok event has a \f(CW\*(C`todo\*(C'\fR field which should have the todo reason. The event also has the \f(CW\*(C`pass\*(C'\fR and \f(CW\*(C`effective_pass\*(C'\fR fields. The \&\f(CW\*(C`pass\*(C'\fR field is the actual pass/fail value. The \f(CW\*(C`effective_pass\*(C'\fR is used to determine if the event is an actual failure (should always be set tot true with todo). .SH "HOW THE TODO TOOLS WORK UNDER THE HOOD" .IX Header "HOW THE TODO TOOLS WORK UNDER THE HOOD" The Test2::Todo library gets the current Test2::Hub instance and adds a filter. The filter that is added will set the todo and effective pass fields on any Test2::Event::Ok events that pass through the hub. The filter also converts Test2::Event::Diag events into Test2::Event::Note events. .SH "SEE ALSO" .IX Header "SEE ALSO" Test2::Manual \- Primary index of the manual. .SH "SOURCE" .IX Header "SOURCE" The source code repository for Test2\-Manual can be found at \&\fIhttps://github.com/Test\-More/Test2\-Suite/\fR. .SH "MAINTAINERS" .IX Header "MAINTAINERS" .IP "Chad Granum " 4 .IX Item "Chad Granum " .SH "AUTHORS" .IX Header "AUTHORS" .PD 0 .IP "Chad Granum " 4 .IX Item "Chad Granum " .PD .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2018 Chad Granum . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See \fIhttp://dev.perl.org/licenses/\fR