- SEE ALSO
- COPYRIGHT AND LICENSE
Test::Doctest - extract and evaluate tests from pod fragments
perl -Ilib -MTest::Doctest -e run Some/Module.pm - or - perl -Ilib -MTest::Doctest -e run Some::Module - or - use Test::Doctest; runtests($filepath); - or - use Test::Doctest; my $p = Test::Doctest->new; $p->parse_from_filehandle(\*STDIN); $p->test;
run and runtests uses Pod::Parser to extract pod text from the files specified, evaluates each line begining with a prompt (>>>), and finally compares the results with the expected output using is_eq from Test::Builder.
>>> 1 + 1 2 >>> my @a = qw(2 3 4) 3 >>> use Pod::Parser; >>> my $p = Pod::Parser->new; >>> ref $p; 'Pod::Parser' >>> $a = 10 10 >>> $a *= 2 20
See more examples in Test::Doctest::Example.
Extract and run tests from pod for each file in @ARGV.
Extract and run tests from pod for each file argument.
Initialize this Test::Doctest pod parser. This method is not typically called directly, but rather, is called by Pod::Parser::new when creating a new parser.
Override Pod::Parser::command to save the name of the current section which is used to name the tests.
Override Pod::Parser::textblock to ignore normal blocks of pod text.
Override Pod::Parser::verbatim to search verbatim paragraphs for doctest code blocks. Each block found, along with information about its location in the file and its expected output is appended to the list of tests to be executed.
Evaluates each test discovered via parsing and compares the results with the expected output using Test::Builder::is_eq.
Pod::Parser defines the parser interface used to extract the tests.
Test::Builder is used to plan the tests and determine the results.
Test::Deep is used to compare test result with expected value.
Bryan Cardillo <email@example.com>
Andrei Fyodorov <firstname.lastname@example.org>
Git repository is maintained by Maikel Linke <email@example.com>
Please submit bugs to the issue tracker.
Copyright (C) 2009 by Bryan Cardillo
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.