argra****@users*****
argra****@users*****
2013年 11月 2日 (土) 16:53:52 JST
Index: docs/modules/Test-Simple-0.98/Test/Builder/Module.pod diff -u /dev/null docs/modules/Test-Simple-0.98/Test/Builder/Module.pod:1.1 --- /dev/null Sat Nov 2 16:53:52 2013 +++ docs/modules/Test-Simple-0.98/Test/Builder/Module.pod Sat Nov 2 16:53:52 2013 @@ -0,0 +1,252 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +Test::Builder::Module - Base class for test modules + +=end original + +Test::Builder::Module - テストモジュールのための基底クラス + +=head1 SYNOPSIS + + # Emulates Test::Simple + package Your::Module; + + my $CLASS = __PACKAGE__; + + use base 'Test::Builder::Module'; + @EXPORT = qw(ok); + + sub ok ($;$) { + my $tb = $CLASS->builder; + return $tb->ok(@_); + } + + 1; + +=head1 DESCRIPTION + +=begin original + +This is a superclass for Test::Builder-based modules. It provides a +handful of common functionality and a method of getting at the underlying +Test::Builder object. + +=end original + +これは Test::Builder ベースのモジュールのスーパークラスです。 +基となる Test::Builder オブジェクトを使う、便利な共通機能とメソッドを +提供します。 + +=head2 Importing + +=begin original + +Test::Builder::Module is a subclass of Exporter which means your +module is also a subclass of Exporter. @EXPORT, @EXPORT_OK, etc... +all act normally. + +=end original + +Test::Builder::Module is a subclass of Exporter which means your +module is also a subclass of Exporter. @EXPORT, @EXPORT_OK, etc... +all act normally. +(TBT) + +=begin original + +A few methods are provided to do the C<use Your::Module tests => 23> part +for you. + +=end original + +A few methods are provided to do the C<use Your::Module tests => 23> part +for you. +(TBT) + +=head3 import + +=begin original + +Test::Builder::Module provides an import() method which acts in the +same basic way as Test::More's, setting the plan and controlling +exporting of functions and variables. This allows your module to set +the plan independent of Test::More. + +=end original + +Test::Builder::Module provides an import() method which acts in the +same basic way as Test::More's, setting the plan and controlling +exporting of functions and variables. This allows your module to set +the plan independent of Test::More. +(TBT) + +=begin original + +All arguments passed to import() are passed onto +C<< Your::Module->builder->plan() >> with the exception of +C<< import =>[qw(things to import)] >>. + +=end original + +All arguments passed to import() are passed onto +C<< Your::Module->builder->plan() >> with the exception of +C<< import =>[qw(things to import)] >>. +(TBT) + + use Your::Module import => [qw(this that)], tests => 23; + +=begin original + +says to import the functions this() and that() as well as set the plan +to be 23 tests. + +=end original + +says to import the functions this() and that() as well as set the plan +to be 23 tests. +(TBT) + +=begin original + +import() also sets the exported_to() attribute of your builder to be +the caller of the import() function. + +=end original + +import() also sets the exported_to() attribute of your builder to be +the caller of the import() function. +(TBT) + +=begin original + +Additional behaviors can be added to your import() method by overriding +import_extra(). + +=end original + +Additional behaviors can be added to your import() method by overriding +import_extra(). +(TBT) + +=cut + +=head3 import_extra + + Your::Module->import_extra(\@import_args); + +=begin original + +import_extra() is called by import(). It provides an opportunity for you +to add behaviors to your module based on its import list. + +=end original + +import_extra() is called by import(). It provides an opportunity for you +to add behaviors to your module based on its import list. +(TBT) + +=begin original + +Any extra arguments which shouldn't be passed on to plan() should be +stripped off by this method. + +=end original + +Any extra arguments which shouldn't be passed on to plan() should be +stripped off by this method. +(TBT) + +=begin original + +See Test::More for an example of its use. + +=end original + +See Test::More for an example of its use. +(TBT) + +=begin original + +B<NOTE> This mechanism is I<VERY ALPHA AND LIKELY TO CHANGE> as it +feels like a bit of an ugly hack in its current form. + +=end original + +B<NOTE> This mechanism is I<VERY ALPHA AND LIKELY TO CHANGE> as it +feels like a bit of an ugly hack in its current form. +(TBT) + +=cut + +=head2 Builder + +=begin original + +Test::Builder::Module provides some methods of getting at the underlying +Test::Builder object. + +=end original + +Test::Builder::Module provides some methods of getting at the underlying +Test::Builder object. +(TBT) + +=head3 builder + + my $builder = Your::Class->builder; + +=begin original + +This method returns the Test::Builder object associated with Your::Class. +It is not a constructor so you can call it as often as you like. + +=end original + +This method returns the Test::Builder object associated with Your::Class. +It is not a constructor so you can call it as often as you like. +(TBT) + +=begin original + +This is the preferred way to get the Test::Builder object. You should +I<not> get it via C<< Test::Builder->new >> as was previously +recommended. + +=end original + +This is the preferred way to get the Test::Builder object. You should +I<not> get it via C<< Test::Builder->new >> as was previously +recommended. +(TBT) + +=begin original + +The object returned by builder() may change at runtime so you should +call builder() inside each function rather than store it in a global. + +=end original + +The object returned by builder() may change at runtime so you should +call builder() inside each function rather than store it in a global. +(TBT) + + sub ok { + my $builder = Your::Class->builder; + + return $builder->ok(@_); + } + +=begin meta + +Translate: SHIRAKATA Kentaro <argra****@ub32*****> +Status: in progress + +=end meta + +=cut + Index: docs/modules/Test-Simple-0.98/Test/Builder/Tester.pod diff -u /dev/null docs/modules/Test-Simple-0.98/Test/Builder/Tester.pod:1.1 --- /dev/null Sat Nov 2 16:53:52 2013 +++ docs/modules/Test-Simple-0.98/Test/Builder/Tester.pod Sat Nov 2 16:53:52 2013 @@ -0,0 +1,601 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +Test::Builder::Tester - test testsuites that have been built with +Test::Builder + +=end original + +Test::Builder::Tester - Test::Builder で構築されたテストスイートをテストする + +=head1 SYNOPSIS + + use Test::Builder::Tester tests => 1; + use Test::More; + + test_out("not ok 1 - foo"); + test_fail(+1); + fail("foo"); + test_test("fail works"); + +=head1 DESCRIPTION + +=begin original + +A module that helps you test testing modules that are built with +B<Test::Builder>. + +=end original + +B<Test::Builder> で構築されたテストモジュールをテストするのを助ける +モジュールです。 + +=begin original + +The testing system is designed to be used by performing a three step +process for each test you wish to test. This process starts with using +C<test_out> and C<test_err> in advance to declare what the testsuite you +are testing will output with B<Test::Builder> to stdout and stderr. + +=end original + +The testing system is designed to be used by performing a three step +process for each test you wish to test. This process starts with using +C<test_out> and C<test_err> in advance to declare what the testsuite you +are testing will output with B<Test::Builder> to stdout and stderr. +(TBT) + +=begin original + +You then can run the test(s) from your test suite that call +B<Test::Builder>. At this point the output of B<Test::Builder> is +safely captured by B<Test::Builder::Tester> rather than being +interpreted as real test output. + +=end original + +You then can run the test(s) from your test suite that call +B<Test::Builder>. At this point the output of B<Test::Builder> is +safely captured by B<Test::Builder::Tester> rather than being +interpreted as real test output. +(TBT) + +=begin original + +The final stage is to call C<test_test> that will simply compare what you +predeclared to what B<Test::Builder> actually outputted, and report the +results back with a "ok" or "not ok" (with debugging) to the normal +output. + +=end original + +The final stage is to call C<test_test> that will simply compare what you +predeclared to what B<Test::Builder> actually outputted, and report the +results back with a "ok" or "not ok" (with debugging) to the normal +output. +(TBT) + +=cut + +=head2 Functions + +=begin original + +These are the six methods that are exported as default. + +=end original + +These are the six methods that are exported as default. +(TBT) + +=over 4 + +=item test_out + +=item test_err + +=begin original + +Procedures for predeclaring the output that your test suite is +expected to produce until C<test_test> is called. These procedures +automatically assume that each line terminates with "\n". So + +=end original + +Procedures for predeclaring the output that your test suite is +expected to produce until C<test_test> is called. These procedures +automatically assume that each line terminates with "\n". So +(TBT) + + test_out("ok 1","ok 2"); + +=begin original + +is the same as + +=end original + +is the same as +(TBT) + + test_out("ok 1\nok 2"); + +=begin original + +which is even the same as + +=end original + +which is even the same as +(TBT) + + test_out("ok 1"); + test_out("ok 2"); + +=begin original + +Once C<test_out> or C<test_err> (or C<test_fail> or C<test_diag>) have +been called, all further output from B<Test::Builder> will be +captured by B<Test::Builder::Tester>. This means that you will not +be able perform further tests to the normal output in the normal way +until you call C<test_test> (well, unless you manually meddle with the +output filehandles) + +=end original + +Once C<test_out> or C<test_err> (or C<test_fail> or C<test_diag>) have +been called, all further output from B<Test::Builder> will be +captured by B<Test::Builder::Tester>. This means that you will not +be able perform further tests to the normal output in the normal way +until you call C<test_test> (well, unless you manually meddle with the +output filehandles) +(TBT) + +=cut + +=item test_fail + +=begin original + +Because the standard failure message that B<Test::Builder> produces +whenever a test fails will be a common occurrence in your test error +output, and because it has changed between Test::Builder versions, rather +than forcing you to call C<test_err> with the string all the time like +so + +=end original + +Because the standard failure message that B<Test::Builder> produces +whenever a test fails will be a common occurrence in your test error +output, and because it has changed between Test::Builder versions, rather +than forcing you to call C<test_err> with the string all the time like +so +(TBT) + + test_err("# Failed test ($0 at line ".line_num(+1).")"); + +=begin original + +C<test_fail> exists as a convenience function that can be called +instead. It takes one argument, the offset from the current line that +the line that causes the fail is on. + +=end original + +C<test_fail> exists as a convenience function that can be called +instead. It takes one argument, the offset from the current line that +the line that causes the fail is on. +(TBT) + + test_fail(+1); + +=begin original + +This means that the example in the synopsis could be rewritten +more simply as: + +=end original + +This means that the example in the synopsis could be rewritten +more simply as: +(TBT) + + test_out("not ok 1 - foo"); + test_fail(+1); + fail("foo"); + test_test("fail works"); + +=cut + +=item test_diag + +=begin original + +As most of the remaining expected output to the error stream will be +created by Test::Builder's C<diag> function, B<Test::Builder::Tester> +provides a convenience function C<test_diag> that you can use instead of +C<test_err>. + +=end original + +As most of the remaining expected output to the error stream will be +created by Test::Builder's C<diag> function, B<Test::Builder::Tester> +provides a convenience function C<test_diag> that you can use instead of +C<test_err>. +(TBT) + +=begin original + +The C<test_diag> function prepends comment hashes and spacing to the +start and newlines to the end of the expected output passed to it and +adds it to the list of expected error output. So, instead of writing + +=end original + +The C<test_diag> function prepends comment hashes and spacing to the +start and newlines to the end of the expected output passed to it and +adds it to the list of expected error output. So, instead of writing +(TBT) + + test_err("# Couldn't open file"); + +=begin original + +you can write + +=end original + +you can write +(TBT) + + test_diag("Couldn't open file"); + +=begin original + +Remember that B<Test::Builder>'s diag function will not add newlines to +the end of output and test_diag will. So to check + +=end original + +Remember that B<Test::Builder>'s diag function will not add newlines to +the end of output and test_diag will. So to check +(TBT) + + Test::Builder->new->diag("foo\n","bar\n"); + +=begin original + +You would do + +=end original + +You would do +(TBT) + + test_diag("foo","bar") + +=begin original + +without the newlines. + +=end original + +without the newlines. +(TBT) + +=cut + +=item test_test + +=begin original + +Actually performs the output check testing the tests, comparing the +data (with C<eq>) that we have captured from B<Test::Builder> against +that that was declared with C<test_out> and C<test_err>. + +=end original + +Actually performs the output check testing the tests, comparing the +data (with C<eq>) that we have captured from B<Test::Builder> against +that that was declared with C<test_out> and C<test_err>. +(TBT) + +=begin original + +This takes name/value pairs that effect how the test is run. + +=end original + +This takes name/value pairs that effect how the test is run. +(TBT) + +=over + +=item title (synonym 'name', 'label') + +=begin original + +The name of the test that will be displayed after the C<ok> or C<not +ok>. + +=end original + +The name of the test that will be displayed after the C<ok> or C<not +ok>. +(TBT) + +=item skip_out + +=begin original + +Setting this to a true value will cause the test to ignore if the +output sent by the test to the output stream does not match that +declared with C<test_out>. + +=end original + +Setting this to a true value will cause the test to ignore if the +output sent by the test to the output stream does not match that +declared with C<test_out>. +(TBT) + +=item skip_err + +=begin original + +Setting this to a true value will cause the test to ignore if the +output sent by the test to the error stream does not match that +declared with C<test_err>. + +=end original + +Setting this to a true value will cause the test to ignore if the +output sent by the test to the error stream does not match that +declared with C<test_err>. +(TBT) + +=back + +=begin original + +As a convenience, if only one argument is passed then this argument +is assumed to be the name of the test (as in the above examples.) + +=end original + +As a convenience, if only one argument is passed then this argument +is assumed to be the name of the test (as in the above examples.) +(TBT) + +=begin original + +Once C<test_test> has been run test output will be redirected back to +the original filehandles that B<Test::Builder> was connected to +(probably STDOUT and STDERR,) meaning any further tests you run +will function normally and cause success/errors for B<Test::Harness>. + +=end original + +Once C<test_test> has been run test output will be redirected back to +the original filehandles that B<Test::Builder> was connected to +(probably STDOUT and STDERR,) meaning any further tests you run +will function normally and cause success/errors for B<Test::Harness>. +(TBT) + +=cut + +=item line_num + +=begin original + +A utility function that returns the line number that the function was +called on. You can pass it an offset which will be added to the +result. This is very useful for working out the correct text of +diagnostic functions that contain line numbers. + +=end original + +A utility function that returns the line number that the function was +called on. You can pass it an offset which will be added to the +result. This is very useful for working out the correct text of +diagnostic functions that contain line numbers. +(TBT) + +=begin original + +Essentially this is the same as the C<__LINE__> macro, but the +C<line_num(+3)> idiom is arguably nicer. + +=end original + +Essentially this is the same as the C<__LINE__> macro, but the +C<line_num(+3)> idiom is arguably nicer. +(TBT) + +=cut + +=back + +=begin original + +In addition to the six exported functions there exists one +function that can only be accessed with a fully qualified function +call. + +=end original + +In addition to the six exported functions there exists one +function that can only be accessed with a fully qualified function +call. +(TBT) + +=over 4 + +=item color + +=begin original + +When C<test_test> is called and the output that your tests generate +does not match that which you declared, C<test_test> will print out +debug information showing the two conflicting versions. As this +output itself is debug information it can be confusing which part of +the output is from C<test_test> and which was the original output from +your original tests. Also, it may be hard to spot things like +extraneous whitespace at the end of lines that may cause your test to +fail even though the output looks similar. + +=end original + +When C<test_test> is called and the output that your tests generate +does not match that which you declared, C<test_test> will print out +debug information showing the two conflicting versions. As this +output itself is debug information it can be confusing which part of +the output is from C<test_test> and which was the original output from +your original tests. Also, it may be hard to spot things like +extraneous whitespace at the end of lines that may cause your test to +fail even though the output looks similar. +(TBT) + +=begin original + +To assist you C<test_test> can colour the background of the debug +information to disambiguate the different types of output. The debug +output will have its background coloured green and red. The green +part represents the text which is the same between the executed and +actual output, the red shows which part differs. + +=end original + +To assist you C<test_test> can colour the background of the debug +information to disambiguate the different types of output. The debug +output will have its background coloured green and red. The green +part represents the text which is the same between the executed and +actual output, the red shows which part differs. +(TBT) + +=begin original + +The C<color> function determines if colouring should occur or not. +Passing it a true or false value will enable or disable colouring +respectively, and the function called with no argument will return the +current setting. + +=end original + +The C<color> function determines if colouring should occur or not. +Passing it a true or false value will enable or disable colouring +respectively, and the function called with no argument will return the +current setting. +(TBT) + +=begin original + +To enable colouring from the command line, you can use the +B<Text::Builder::Tester::Color> module like so: + +=end original + +To enable colouring from the command line, you can use the +B<Text::Builder::Tester::Color> module like so: +(TBT) + + perl -Mlib=Text::Builder::Tester::Color test.t + +=begin original + +Or by including the B<Test::Builder::Tester::Color> module directly in +the PERL5LIB. + +=end original + +Or by including the B<Test::Builder::Tester::Color> module directly in +the PERL5LIB. +(TBT) + +=cut + +=back + +=head1 BUGS + +=begin original + +Calls C<<Test::Builder->no_ending>> turning off the ending tests. +This is needed as otherwise it will trip out because we've run more +tests than we strictly should have and it'll register any failures we +had that we were testing for as real failures. + +=end original + +Calls C<<Test::Builder->no_ending>> turning off the ending tests. +This is needed as otherwise it will trip out because we've run more +tests than we strictly should have and it'll register any failures we +had that we were testing for as real failures. +(TBT) + +=begin original + +The color function doesn't work unless B<Term::ANSIColor> is +compatible with your terminal. + +=end original + +The color function doesn't work unless B<Term::ANSIColor> is +compatible with your terminal. +(TBT) + +=begin original + +Bugs (and requests for new features) can be reported to the author +though the CPAN RT system: +L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Builder-Tester> + +=end original + +Bugs (and requests for new features) can be reported to the author +though the CPAN RT system: +L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Builder-Tester> +(TBT) + +=head1 AUTHOR + +Copyright Mark Fowler E<lt>mark****@twosh*****<gt> 2002, 2004. + +Some code taken from B<Test::More> and B<Test::Catch>, written by by +Michael G Schwern E<lt>schwe****@pobox*****<gt>. Hence, those parts +Copyright Micheal G Schwern 2001. Used and distributed with +permission. + +This program is free software; you can redistribute it +and/or modify it under the same terms as Perl itself. + +=head1 NOTES + +=begin original + +Thanks to Richard Clamp E<lt>richa****@unixb*****<gt> for letting +me use his testing system to try this module out on. + +=end original + +Thanks to Richard Clamp E<lt>richa****@unixb*****<gt> for letting +me use his testing system to try this module out on. +(TBT) + +=head1 SEE ALSO + +L<Test::Builder>, L<Test::Builder::Tester::Color>, L<Test::More>. + +=begin meta + +Translate: SHIRAKATA Kentaro <argra****@ub32*****> +Status: in progress + +=end meta + +=cut +