diff options
Diffstat (limited to 'cpan/Test-Simple/t')
-rw-r--r-- | cpan/Test-Simple/t/478-cmp_ok_hash.t | 41 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/388-threadedsubtest.load | 3 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/388-threadedsubtest.t | 38 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t | 97 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/MonkeyPatching_done_testing.t | 61 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/MonkeyPatching_note.t | 97 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/MonkeyPatching_ok.t | 108 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t | 86 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/Munge.t | 30 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/NotTB15.t | 48 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/Tester2_subtest.t | 69 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/cmp_ok_xor.t | 13 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/encoding_test.t | 35 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/fork_new_end.t | 53 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/skip_all_in_subtest.load | 10 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t | 16 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/threads_with_taint_mode.t | 47 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Behavior/todo.t | 43 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Builder/fork_with_new_stdout.t | 54 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Builder/try.t | 42 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/BEGIN_require_ok.t (renamed from cpan/Test-Simple/t/BEGIN_require_ok.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/BEGIN_use_ok.t (renamed from cpan/Test-Simple/t/BEGIN_use_ok.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/Builder.t (renamed from cpan/Test-Simple/t/Builder/Builder.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/carp.t (renamed from cpan/Test-Simple/t/Builder/carp.t) | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/create.t (renamed from cpan/Test-Simple/t/Builder/create.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/current_test.t (renamed from cpan/Test-Simple/t/Builder/current_test.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/current_test_without_plan.t (renamed from cpan/Test-Simple/t/Builder/current_test_without_plan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/details.t (renamed from cpan/Test-Simple/t/Builder/details.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/done_testing.t (renamed from cpan/Test-Simple/t/Builder/done_testing.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/done_testing_double.t (renamed from cpan/Test-Simple/t/Builder/done_testing_double.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/done_testing_plan_mismatch.t (renamed from cpan/Test-Simple/t/Builder/done_testing_plan_mismatch.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/done_testing_with_no_plan.t (renamed from cpan/Test-Simple/t/Builder/done_testing_with_no_plan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/done_testing_with_number.t (renamed from cpan/Test-Simple/t/Builder/done_testing_with_number.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/done_testing_with_plan.t (renamed from cpan/Test-Simple/t/Builder/done_testing_with_plan.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/fork_with_new_stdout.t | 60 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/has_plan.t (renamed from cpan/Test-Simple/t/Builder/has_plan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/has_plan2.t (renamed from cpan/Test-Simple/t/Builder/has_plan2.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/is_fh.t (renamed from cpan/Test-Simple/t/Builder/is_fh.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/is_passing.t (renamed from cpan/Test-Simple/t/Builder/is_passing.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/maybe_regex.t (renamed from cpan/Test-Simple/t/Builder/maybe_regex.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/no_diag.t (renamed from cpan/Test-Simple/t/Builder/no_diag.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/no_ending.t (renamed from cpan/Test-Simple/t/Builder/no_ending.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/no_header.t (renamed from cpan/Test-Simple/t/Builder/no_header.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/no_plan_at_all.t (renamed from cpan/Test-Simple/t/Builder/no_plan_at_all.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/ok_obj.t (renamed from cpan/Test-Simple/t/Builder/ok_obj.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/output.t (renamed from cpan/Test-Simple/t/Builder/output.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/reset.t (renamed from cpan/Test-Simple/t/Builder/reset.t) | 3 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Builder/reset_outputs.t | 35 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/More.t (renamed from cpan/Test-Simple/t/More.t) | 7 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/PerlIO.t | 11 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Simple/load.t (renamed from cpan/Test-Simple/t/Simple/load.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/TestTester/auto.t | 32 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/TestTester/check_tests.t | 116 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/TestTester/depth.t | 39 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/TestTester/is_bug.t | 31 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/TestTester/run_test.t | 145 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_01basic.t (renamed from cpan/Test-Simple/t/Tester/tbt_01basic.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_02fhrestore.t (renamed from cpan/Test-Simple/t/Tester/tbt_02fhrestore.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_03die.t (renamed from cpan/Test-Simple/t/Tester/tbt_03die.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_04line_num.t (renamed from cpan/Test-Simple/t/Tester/tbt_04line_num.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_05faildiag.t (renamed from cpan/Test-Simple/t/Tester/tbt_05faildiag.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_06errormess.t (renamed from cpan/Test-Simple/t/Tester/tbt_06errormess.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_07args.t (renamed from cpan/Test-Simple/t/Tester/tbt_07args.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_08subtest.t (renamed from cpan/Test-Simple/t/Tester/tbt_08subtest.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_09do.t (renamed from cpan/Test-Simple/t/Tester/tbt_09do.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/Tester/tbt_09do_script.pl (renamed from cpan/Test-Simple/t/Tester/tbt_09do_script.pl) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/bad_plan.t (renamed from cpan/Test-Simple/t/bad_plan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/bail_out.t (renamed from cpan/Test-Simple/t/bail_out.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/buffer.t (renamed from cpan/Test-Simple/t/buffer.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/c_flag.t (renamed from cpan/Test-Simple/t/c_flag.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/circular_data.t (renamed from cpan/Test-Simple/t/circular_data.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/cmp_ok.t (renamed from cpan/Test-Simple/t/cmp_ok.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/dependents.t (renamed from cpan/Test-Simple/t/dependents.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/diag.t (renamed from cpan/Test-Simple/t/diag.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/died.t (renamed from cpan/Test-Simple/t/died.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/dont_overwrite_die_handler.t (renamed from cpan/Test-Simple/t/dont_overwrite_die_handler.t) | 1 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/eq_set.t (renamed from cpan/Test-Simple/t/eq_set.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/exit.t (renamed from cpan/Test-Simple/t/exit.t) | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/explain.t (renamed from cpan/Test-Simple/t/explain.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/extra.t (renamed from cpan/Test-Simple/t/extra.t) | 11 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/extra_one.t (renamed from cpan/Test-Simple/t/extra_one.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/fail-like.t (renamed from cpan/Test-Simple/t/fail-like.t) | 8 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/fail-more.t (renamed from cpan/Test-Simple/t/fail-more.t) | 15 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/fail.t (renamed from cpan/Test-Simple/t/fail.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/fail_one.t (renamed from cpan/Test-Simple/t/fail_one.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/filehandles.t (renamed from cpan/Test-Simple/t/filehandles.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/fork.t (renamed from cpan/Test-Simple/t/fork.t) | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/fork_in_subtest.t | 45 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/harness_active.t (renamed from cpan/Test-Simple/t/harness_active.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/import.t (renamed from cpan/Test-Simple/t/import.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/is_deeply_dne_bug.t (renamed from cpan/Test-Simple/t/is_deeply_dne_bug.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/is_deeply_fail.t (renamed from cpan/Test-Simple/t/is_deeply_fail.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/is_deeply_with_threads.t (renamed from cpan/Test-Simple/t/is_deeply_with_threads.t) | 17 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/missing.t (renamed from cpan/Test-Simple/t/missing.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/new_ok.t (renamed from cpan/Test-Simple/t/new_ok.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/no_plan.t (renamed from cpan/Test-Simple/t/no_plan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/no_tests.t (renamed from cpan/Test-Simple/t/no_tests.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/note.t (renamed from cpan/Test-Simple/t/note.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/overload.t (renamed from cpan/Test-Simple/t/overload.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/overload_threads.t (renamed from cpan/Test-Simple/t/overload_threads.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/plan.t (renamed from cpan/Test-Simple/t/plan.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/plan_bad.t (renamed from cpan/Test-Simple/t/plan_bad.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/plan_is_noplan.t (renamed from cpan/Test-Simple/t/plan_is_noplan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/plan_no_plan.t (renamed from cpan/Test-Simple/t/plan_no_plan.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/plan_shouldnt_import.t (renamed from cpan/Test-Simple/t/plan_shouldnt_import.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/plan_skip_all.t (renamed from cpan/Test-Simple/t/plan_skip_all.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/pod.t | 7 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/require_ok.t (renamed from cpan/Test-Simple/t/require_ok.t) | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/ribasushi_diag.t | 59 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/ribasushi_threads.t | 77 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/ribasushi_threads2.t | 51 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/simple.t (renamed from cpan/Test-Simple/t/simple.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/skip.t (renamed from cpan/Test-Simple/t/skip.t) | 14 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/skipall.t (renamed from cpan/Test-Simple/t/skipall.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/strays.t | 27 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/args.t (renamed from cpan/Test-Simple/t/subtest/args.t) | 1 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/bail_out.t (renamed from cpan/Test-Simple/t/subtest/bail_out.t) | 29 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/basic.t (renamed from cpan/Test-Simple/t/subtest/basic.t) | 11 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/die.t (renamed from cpan/Test-Simple/t/subtest/die.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/do.t (renamed from cpan/Test-Simple/t/subtest/do.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/exceptions.t (renamed from cpan/Test-Simple/t/subtest/exceptions.t) | 10 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/for_do_t.test (renamed from cpan/Test-Simple/t/subtest/for_do_t.test) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/fork.t (renamed from cpan/Test-Simple/t/subtest/fork.t) | 15 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/implicit_done.t (renamed from cpan/Test-Simple/t/subtest/implicit_done.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/line_numbers.t (renamed from cpan/Test-Simple/t/subtest/line_numbers.t) | 21 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/plan.t (renamed from cpan/Test-Simple/t/subtest/plan.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/predicate.t (renamed from cpan/Test-Simple/t/subtest/predicate.t) | 12 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/singleton.t (renamed from cpan/Test-Simple/t/subtest/singleton.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/threads.t (renamed from cpan/Test-Simple/t/subtest/threads.t) | 4 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/todo.t (renamed from cpan/Test-Simple/t/subtest/todo.t) | 24 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/subtest/wstat.t (renamed from cpan/Test-Simple/t/subtest/wstat.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t (renamed from cpan/Test-Simple/t/tbm_doesnt_set_exported_to.t) | 2 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/test_use_ok.t | 40 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/thread_taint.t (renamed from cpan/Test-Simple/t/thread_taint.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/threads.t | 47 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/todo.t (renamed from cpan/Test-Simple/t/todo.t) | 14 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/undef.t (renamed from cpan/Test-Simple/t/undef.t) | 13 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/use_ok.t (renamed from cpan/Test-Simple/t/use_ok.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/useing.t (renamed from cpan/Test-Simple/t/useing.t) | 0 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/utf8.t (renamed from cpan/Test-Simple/t/utf8.t) | 6 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Legacy/versions.t | 50 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Builder.t | 10 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-More-DeepCheck.t | 7 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-More.t | 29 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-MostlyLike.t | 159 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Simple.t | 24 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-ArrayBase-Meta.t | 10 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-ArrayBase.t | 97 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Carp.t | 53 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Event-Diag.t | 24 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Event-Finish.t | 7 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Event-Note.t | 19 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Event.t | 30 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-ExitMagic-Context.t | 8 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Exporter-Meta.t | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Exporter.t | 130 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-IOSets.t | 31 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Meta.t | 16 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-PackageUtil.t | 38 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Tester-Grab.t | 11 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Tester.t | 140 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Toolset.t | 11 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Stream-Util.t | 45 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Tester-Capture.t | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-Tester.t | 9 | ||||
-rw-r--r-- | cpan/Test-Simple/t/Test-use-ok.t | 25 | ||||
-rw-r--r-- | cpan/Test-Simple/t/lib/MyTest.pm | 15 | ||||
-rw-r--r-- | cpan/Test-Simple/t/lib/SmallTest.pm | 35 | ||||
-rw-r--r-- | cpan/Test-Simple/t/threads.t | 33 | ||||
-rw-r--r-- | cpan/Test-Simple/t/versions.t | 28 |
170 files changed, 2918 insertions, 329 deletions
diff --git a/cpan/Test-Simple/t/478-cmp_ok_hash.t b/cpan/Test-Simple/t/478-cmp_ok_hash.t deleted file mode 100644 index 811835b9d3..0000000000 --- a/cpan/Test-Simple/t/478-cmp_ok_hash.t +++ /dev/null @@ -1,41 +0,0 @@ -use strict; -use warnings; -use Test::More; - - -my $want = 0; -my $got = 0; - -cmp_ok($got, 'eq', $want, "Passes on correct comparison"); - -my ($res, @ok, @diag, @warn); -{ - no warnings 'redefine'; - local *Test::Builder::ok = sub { - my ($tb, $ok, $name) = @_; - push @ok => $ok; - return $ok; - }; - local *Test::Builder::diag = sub { - my ($tb, @d) = @_; - push @diag => @d; - }; - local $SIG{__WARN__} = sub { - push @warn => @_; - }; - $res = cmp_ok($got, '#eq', $want, "You shall not pass!"); -} - -ok(!$res, "Did not pass"); - -is(@ok, 1, "1 result"); -ok(!$ok[0], "result is false"); - -# We only care that it mentions a syntax error. -like(join("\n" => @diag), qr/syntax error at \(eval in cmp_ok\)/, "Syntax error"); - -# We are not going to inspect the warning because it is not super predictable, -# and changes with eval specifics. -ok(@warn, "We got warnings"); - -done_testing; diff --git a/cpan/Test-Simple/t/Behavior/388-threadedsubtest.load b/cpan/Test-Simple/t/Behavior/388-threadedsubtest.load new file mode 100644 index 0000000000..ee341250e8 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/388-threadedsubtest.load @@ -0,0 +1,3 @@ +use Test::More; +ok(1,"name"); +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/388-threadedsubtest.t b/cpan/Test-Simple/t/Behavior/388-threadedsubtest.t new file mode 100644 index 0000000000..44a586c843 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/388-threadedsubtest.t @@ -0,0 +1,38 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Config; + +BEGIN { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { + print "1..0 # Skip no working threads\n"; + exit 0; + } + + unless ( $ENV{AUTHOR_TESTING} ) { + print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; + exit 0; + } +} + +use threads; +use Test::More; + +subtest my_subtest => sub { + my $file = __FILE__; + $file =~ s/\.t$/.load/; + do $file || die $@; +}; + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t new file mode 100644 index 0000000000..978e3f3313 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_diag.t @@ -0,0 +1,97 @@ +use strict; +use warnings; +use B; + +use Test::Stream; +use Test::MostlyLike; +use Test::More tests => 3; +use Test::Builder; # Not loaded by default in modern mode +my $orig = Test::Builder->can('diag'); + +{ + package MyModernTester; + use Test::More; + use Test::Stream; + use Test::MostlyLike; + + no warnings 'redefine'; + local *Test::Builder::diag = sub { + my $self = shift; + return $self->$orig(__PACKAGE__ . ": ", @_); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::diag)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + diag('first'); + diag('seconds'); + } + mostly_like( + \@warnings, + [ + qr{The new sub is 'MyModernTester::__ANON__' defined in $file around line $line}, + undef, #Only 1 warning + ], + "Found expected warning, just the one" + ); +} + +{ + package MyModernTester2; + use Test::More; + use Test::Stream; + use Test::MostlyLike; + + no warnings 'redefine'; + local *Test::Builder::diag = sub { + my $self = shift; + return $self->$orig(__PACKAGE__ . ": ", @_); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::diag)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + diag('first'); + diag('seconds'); + } + mostly_like( + \@warnings, + [ + qr{The new sub is 'MyModernTester2::__ANON__' defined in $file around line $line}, + undef, #Only 1 warning + ], + "new override, new warning" + ); +} + +{ + package MyLegacyTester; + use Test::More; + + no warnings 'redefine'; + local *Test::Builder::diag = sub { + my $self = shift; + return $self->$orig(__PACKAGE__ . ": ", @_); + }; + use warnings; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + diag('first'); + diag('seconds'); + } + is(@warnings, 0, "no warnings for a legacy tester"); +} diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_done_testing.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_done_testing.t new file mode 100644 index 0000000000..4a1d2851a5 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_done_testing.t @@ -0,0 +1,61 @@ +use strict; +use warnings; +use B; + +use Test::Stream; +use Test::MostlyLike; +use Test::More tests => 4; +use Test::Builder; # Not loaded by default in modern mode +my $orig = Test::Builder->can('done_testing'); + +use Test::Stream::Tester; + +my $ran = 0; +no warnings 'redefine'; +my $file = __FILE__; +my $line = __LINE__ + 1; +*Test::Builder::done_testing = sub { my $self = shift; $ran++; $self->$orig(@_) }; +use warnings; + +my @warnings; +$SIG{__WARN__} = sub { push @warnings => @_ }; + +events_are( + intercept { + ok(1, "pass"); + ok(0, "fail"); + + done_testing; + }, + check { + event ok => { bool => 1 }; + event ok => { bool => 0 }; + event plan => { max => 2 }; + directive 'end'; + }, +); + +events_are( + intercept { + ok(1, "pass"); + ok(0, "fail"); + + done_testing; + }, + check { + event ok => { bool => 1 }; + event ok => { bool => 0 }; + event plan => { max => 2 }; + directive 'end'; + }, +); + +is($ran, 2, "We ran our override both times"); +mostly_like( + \@warnings, + [ + qr{The new sub is 'main::__ANON__' defined in $file around line $line}, + undef, + ], + "Got the warning once" +); diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_note.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_note.t new file mode 100644 index 0000000000..5594acd9db --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_note.t @@ -0,0 +1,97 @@ +use strict; +use warnings; +use B; + +use Test::Stream; +use Test::MostlyLike; +use Test::More tests => 3; +use Test::Builder; # Not loaded by default in modern mode +my $orig = Test::Builder->can('note'); + +{ + package MyModernTester; + use Test::More; + use Test::Stream; + use Test::MostlyLike; + + no warnings 'redefine'; + local *Test::Builder::note = sub { + my $self = shift; + return $self->$orig(__PACKAGE__ . ": ", @_); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::note)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + note('first'); + note('seconds'); + } + mostly_like( + \@warnings, + [ + qr{The new sub is 'MyModernTester::__ANON__' defined in $file around line $line}, + undef, #Only 1 warning + ], + "Found expected warning, just the one" + ); +} + +{ + package MyModernTester2; + use Test::More; + use Test::Stream; + use Test::MostlyLike; + + no warnings 'redefine'; + local *Test::Builder::note = sub { + my $self = shift; + return $self->$orig(__PACKAGE__ . ": ", @_); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::note)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + note('first'); + note('seconds'); + } + mostly_like( + \@warnings, + [ + qr{The new sub is 'MyModernTester2::__ANON__' defined in $file around line $line}, + undef, #Only 1 warning + ], + "new override, new warning" + ); +} + +{ + package MyLegacyTester; + use Test::More; + + no warnings 'redefine'; + local *Test::Builder::note = sub { + my $self = shift; + return $self->$orig(__PACKAGE__ . ": ", @_); + }; + use warnings; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + note('first'); + note('seconds'); + } + is(@warnings, 0, "no warnings for a legacy tester"); +} diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_ok.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_ok.t new file mode 100644 index 0000000000..f10b18b199 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_ok.t @@ -0,0 +1,108 @@ +use strict; +use warnings; +use B; + +use Test::Stream; +use Test::MostlyLike; +use Test::More tests => 9; +use Test::Builder; # Not loaded by default in modern mode +my $orig = Test::Builder->can('ok'); + +{ + package MyModernTester; + use Test::Stream; + use Test::MostlyLike; + use Test::More; + + no warnings 'redefine'; + local *Test::Builder::ok = sub { + my $self = shift; + my ($bool, $name) = @_; + $name = __PACKAGE__ . ": $name"; + return $self->$orig($bool, $name); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::ok)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + ok(1, "fred"); + ok(2, "barney"); + } + mostly_like( + \@warnings, + [ + qr{The new sub is 'MyModernTester::__ANON__' defined in $file around line $line}, + undef, #Only 1 warning + ], + "Found expected warning, just the one" + ); +} + +{ + package MyModernTester2; + use Test::Stream; + use Test::MostlyLike; + use Test::More; + + no warnings 'redefine'; + local *Test::Builder::ok = sub { + my $self = shift; + my ($bool, $name) = @_; + $name = __PACKAGE__ . ": $name"; + return $self->$orig($bool, $name); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::ok)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + ok(1, "fred"); + ok(2, "barney"); + } + mostly_like( + \@warnings, + [ + qr{The new sub is 'MyModernTester2::__ANON__' defined in $file around line $line}, + undef, #Only 1 warning + ], + "new override, new warning" + ); +} + +{ + package MyLegacyTester; + use Test::More; + + no warnings 'redefine'; + local *Test::Builder::ok = sub { + my $self = shift; + my ($bool, $name) = @_; + $name = __PACKAGE__ . ": $name"; + return $self->$orig($bool, $name); + }; + use warnings; + + my $file = __FILE__; + # Line number is tricky, just use what B says The sub may not actually think it + # is on the line it is may be off by 1. + my $line = B::svref_2object(\&Test::Builder::ok)->START->line; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings => @_ }; + ok(1, "fred"); + ok(2, "barney"); + } + is(@warnings, 0, "no warnings for a legacy tester"); +} diff --git a/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t b/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t new file mode 100644 index 0000000000..b44d08c9a7 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/MonkeyPatching_plan.t @@ -0,0 +1,86 @@ +use strict; +use warnings; +use B; + +use Test::Stream; +use Test::MostlyLike; +use Test::More tests => 6; +use Test::Builder; # Not loaded by default in modern mode +my $orig = Test::Builder->can('plan'); + +use Test::Stream::Tester; + +my $ran = 0; +no warnings 'redefine'; +my $file = __FILE__; +my $line = __LINE__ + 1; +*Test::Builder::plan = sub { my $self = shift; $ran++; $self->$orig(@_) }; +use warnings; + +my @warnings; +$SIG{__WARN__} = sub { push @warnings => @_ }; + +events_are( + intercept { + plan tests => 2; + ok(1, "pass"); + ok(0, "fail"); + }, + check { + event plan => { max => 2 }; + event ok => { bool => 1 }; + event ok => { bool => 0 }; + directive 'end'; + }, +); + +events_are( + intercept { + Test::More->import('tests' => 2); + ok(1, "pass"); + ok(0, "fail"); + }, + check { + event plan => { max => 2 }; + event ok => { bool => 1 }; + event ok => { bool => 0 }; + directive 'end'; + }, +); + +events_are( + intercept { + Test::More->import(skip_all => 'damn'); + ok(1, "pass"); + ok(0, "fail"); + }, + check { + event plan => { max => 0, directive => 'SKIP', reason => 'damn' }; + directive 'end'; + }, +); + +events_are( + intercept { + Test::More->import('no_plan'); + ok(1, "pass"); + ok(0, "fail"); + }, + check { + event plan => { directive => 'NO PLAN' }; + event ok => { bool => 1 }; + event ok => { bool => 0 }; + directive 'end'; + }, +); + +is($ran, 4, "We ran our override each time"); +mostly_like( + \@warnings, + [ + qr{The new sub is 'main::__ANON__' defined in $file around line $line}, + undef, + ], + "Got the warning once" +); + diff --git a/cpan/Test-Simple/t/Behavior/Munge.t b/cpan/Test-Simple/t/Behavior/Munge.t new file mode 100644 index 0000000000..be9aa98d5c --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/Munge.t @@ -0,0 +1,30 @@ +use strict; +use warnings; +use Test::Stream; +use Test::More; +use Test::Stream::Tester; + +events_are( + intercept { + my $id = 0; + Test::Stream->shared->munge(sub { + my ($stream, $e) = @_; + return unless $e->isa('Test::Stream::Event::Ok'); + return if defined $e->name; + $e->set_name( 'flubber: ' . $id++ ); + }); + + ok( 1, "Keep the name" ); + ok( 1 ); + ok( 1, "Already named" ); + ok( 1 ); + }, + check { + event ok => { bool => 1, name => "Keep the name" }; + event ok => { bool => 1, name => "flubber: 0" }; + event ok => { bool => 1, name => "Already named" }; + event ok => { bool => 1, name => "flubber: 1" }; + } +); + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/NotTB15.t b/cpan/Test-Simple/t/Behavior/NotTB15.t new file mode 100644 index 0000000000..a70992599d --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/NotTB15.t @@ -0,0 +1,48 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Test::More; +use Test::Builder; + +# This is just a list of method Test::Builder current does not have that Test::Builder 1.5 does. +my @TB15_METHODS = qw{ + _file_and_line _join_message _make_default _my_exit _reset_todo_state + _result_to_hash _results _todo_state formatter history in_test + no_change_exit_code post_event post_result set_formatter set_plan test_end + test_exit_code test_start test_state +}; + +for my $method (qw/foo bar baz/) { + my $success = !eval { Test::Builder->$method; 1 }; my $line = __LINE__; + my $error = $@; + ok($success, "Threw an exception ($method)"); + is( + $error, + qq{Can't locate object method "$method" via package "Test::Builder" at } . __FILE__ . " line $line.\n", + "Did not auto-create random sub ($method)" + ); +} + +my $file = __FILE__; +for my $method (@TB15_METHODS) { + my $success = !eval { Test::Builder->$method; 1 }; my $line = __LINE__; + my $error = $@; + + ok($success, "Threw an exception ($method)"); + + is($error, <<" EOT", "Got expected error ($method)"); +Can't locate object method "$method" via package "Test::Builder" at $file line $line. + + ************************************************************************* + '$method' is a Test::Builder 1.5 method. Test::Builder 1.5 is a dead branch. + You need to update your code so that it no longer treats Test::Builders + over a specific version number as anything special. + + See: http://blogs.perl.org/users/chad_exodist_granum/2014/03/testmore---new-maintainer-also-stop-version-checking.html + ************************************************************************* + EOT +} + +done_testing; + diff --git a/cpan/Test-Simple/t/Behavior/Tester2_subtest.t b/cpan/Test-Simple/t/Behavior/Tester2_subtest.t new file mode 100644 index 0000000000..6101fbb92a --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/Tester2_subtest.t @@ -0,0 +1,69 @@ +use strict; +use warnings; +use utf8; + +use Test::Stream; +use Test::More; +use Test::Stream::Tester; + +my $events = intercept { + ok(0, "test failure" ); + ok(1, "test success" ); + + subtest 'subtest' => sub { + ok(0, "subtest failure" ); + ok(1, "subtest success" ); + + subtest 'subtest_deeper' => sub { + ok(1, "deeper subtest success" ); + }; + }; + + ok(0, "another test failure" ); + ok(1, "another test success" ); +}; + +events_are( + $events, + + check { + event ok => {bool => 0, diag => qr/Fail/}; + event ok => {bool => 1}; + + event note => {message => 'Subtest: subtest'}; + event subtest => { + name => 'subtest', + bool => 0, + diag => qr/Failed test 'subtest'/, + + events => check { + event ok => {bool => 0}; + event ok => {bool => 1}; + + event note => {message => 'Subtest: subtest_deeper'}; + event subtest => { + bool => 1, + name => 'subtest_deeper', + events => check { + event ok => { bool => 1 }; + }, + }; + + event plan => { max => 3 }; + event finish => { tests_run => 3, tests_failed => 1 }; + event diag => { message => qr/Looks like you failed 1 test of 3/ }; + + dir end => 'End of subtests events'; + }, + }; + + event ok => {bool => 0}; + event ok => {bool => 1}; + + dir end => "subtest events as expected"; + }, + + "Subtest events" +); + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/cmp_ok_xor.t b/cpan/Test-Simple/t/Behavior/cmp_ok_xor.t new file mode 100644 index 0000000000..292f7168be --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/cmp_ok_xor.t @@ -0,0 +1,13 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +my @warnings; +$SIG{__WARN__} = sub { push @warnings => @_ }; +my $ok = cmp_ok( 1, 'xor', 0, 'use xor in cmp_ok' ); +ok(!@warnings, "no warnings"); +ok($ok, "returned true"); + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/encoding_test.t b/cpan/Test-Simple/t/Behavior/encoding_test.t new file mode 100644 index 0000000000..57242e03d9 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/encoding_test.t @@ -0,0 +1,35 @@ +use strict; +use warnings; +no utf8; + +# line 5 "encoding_tést.t" + +use Test::Stream; +use Test::More; +use Test::Stream::Tester; + +BEGIN { + my $norm = eval { require Unicode::Normalize; require Encode; 1 }; + plan skip_all => 'Unicode::Normalize is required for this test' unless $norm; +} + +my $filename = __FILE__; +ok(!utf8::is_utf8($filename), "filename is not in utf8 yet"); +my $utf8name = Unicode::Normalize::NFKC(Encode::decode('utf8', "$filename", Encode::FB_CROAK)); +ok( $filename ne $utf8name, "sanity check" ); + +my $scoper = sub { context()->snapshot }; + +tap_encoding 'utf8'; +my $ctx_utf8 = $scoper->(); + +tap_encoding 'legacy'; +my $ctx_legacy = $scoper->(); + +is($ctx_utf8->encoding, 'utf8', "got a utf8 context"); +is($ctx_legacy->encoding, 'legacy', "got a legacy context"); + +is($ctx_utf8->file, $utf8name, "Got utf8 name"); +is($ctx_legacy->file, $filename, "Got legacy name"); + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/fork_new_end.t b/cpan/Test-Simple/t/Behavior/fork_new_end.t new file mode 100644 index 0000000000..d15b9d9164 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/fork_new_end.t @@ -0,0 +1,53 @@ +use strict; +use warnings; + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = '../lib'; + } +} + +use Config; + +BEGIN { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { + print "1..0 # Skip no working threads\n"; + exit 0; + } + + unless ( $ENV{AUTHOR_TESTING} ) { + print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; + exit 0; + } +} + +use Test::More tests => 4; + +ok(1, "outside before"); + +my $run = sub { + ok(1, 'in thread1'); + ok(1, 'in thread2'); +}; + + +my $t = threads->create($run); + +ok(1, "outside after"); + +$t->join; + +END { + print "XXX: " . Test::Builder->new->is_passing . "\n"; +} diff --git a/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.load b/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.load new file mode 100644 index 0000000000..241ce14963 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.load @@ -0,0 +1,10 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Carp qw/confess/; + +use Test::More skip_all => "Cause I feel like it"; + +confess "Should not see this!"; diff --git a/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t b/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t new file mode 100644 index 0000000000..c66901a5a8 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/skip_all_in_subtest.t @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +subtest my_subtest => sub { + my $file = __FILE__; + $file =~ s/\.t$/.load/; + do $file; + note "Got: $@"; + fail($@); +}; + +done_testing; diff --git a/cpan/Test-Simple/t/Behavior/threads_with_taint_mode.t b/cpan/Test-Simple/t/Behavior/threads_with_taint_mode.t new file mode 100644 index 0000000000..5f73ffaac2 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/threads_with_taint_mode.t @@ -0,0 +1,47 @@ +#!/usr/bin/perl -w -T + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = '../lib'; + } +} + +use Config; + +BEGIN { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { + print "1..0 # Skip no working threads\n"; + exit 0; + } + + unless ( $ENV{AUTHOR_TESTING} ) { + print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; + exit 0; + } +} + +use strict; +use Test::Builder; + +my $Test = Test::Builder->new; +$Test->exported_to('main'); +$Test->plan(tests => 6); + +for(1..5) { + 'threads'->create(sub { + $Test->ok(1,"Each of these should app the test number") + })->join; +} + +$Test->is_num($Test->current_test(), 5,"Should be five"); diff --git a/cpan/Test-Simple/t/Behavior/todo.t b/cpan/Test-Simple/t/Behavior/todo.t new file mode 100644 index 0000000000..cb5a6e34b0 --- /dev/null +++ b/cpan/Test-Simple/t/Behavior/todo.t @@ -0,0 +1,43 @@ +use strict; +use warnings; + +use Test::More; +use Test::Stream::Tester; + +my $events = intercept { + local $TODO = ""; + ok(0, "Should not be in todo 1"); + + local $TODO = 0; + ok(0, "Should not be in todo 2"); + + local $TODO = undef; + ok(0, "Should not be in todo 3"); + + local $TODO = "foo"; + ok(0, "Should be in todo"); +}; + +events_are( + $events, + check { + event ok => { in_todo => 0 }; + event ok => { in_todo => 0 }; + event ok => { in_todo => 0 }; + event ok => { in_todo => 1 }; + directive 'end'; + }, + "Verify TODO state" +); + +my $i = 0; +for my $e (@$events) { + next if $e->context->in_todo; + + my @tap = $e->to_tap(++$i); + my $ok_line = $tap[0]; + chomp(my $text = $ok_line->[1]); + is($text, "not ok $i - Should not be in todo $i", "No TODO directive $i"); +} + +done_testing; diff --git a/cpan/Test-Simple/t/Builder/fork_with_new_stdout.t b/cpan/Test-Simple/t/Builder/fork_with_new_stdout.t deleted file mode 100644 index e38c1d08cb..0000000000 --- a/cpan/Test-Simple/t/Builder/fork_with_new_stdout.t +++ /dev/null @@ -1,54 +0,0 @@ -#!perl -w -use strict; -use warnings; -use IO::Pipe; -use Test::Builder; -use Config; - -my $b = Test::Builder->new; -$b->reset; - -my $Can_Fork = $Config{d_fork} || - (($^O eq 'MSWin32' || $^O eq 'NetWare') and - $Config{useithreads} and - $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/ - ); - -if( !$Can_Fork ) { - $b->plan('skip_all' => "This system cannot fork"); -} -else { - $b->plan('tests' => 2); -} - -my $pipe = IO::Pipe->new; -if ( my $pid = fork ) { - $pipe->reader; - $b->ok((<$pipe> =~ /FROM CHILD: ok 1/), "ok 1 from child"); - $b->ok((<$pipe> =~ /FROM CHILD: 1\.\.1/), "1..1 from child"); - waitpid($pid, 0); -} -else { - $pipe->writer; - my $pipe_fd = $pipe->fileno; - close STDOUT; - open(STDOUT, ">&$pipe_fd"); - my $b = Test::Builder->new; - $b->reset; - $b->no_plan; - $b->ok(1); -} - - -=pod -#actual -1..2 -ok 1 -1..1 -ok 1 -ok 2 -#expected -1..2 -ok 1 -ok 2 -=cut diff --git a/cpan/Test-Simple/t/Builder/try.t b/cpan/Test-Simple/t/Builder/try.t deleted file mode 100644 index eeb3bcb1ab..0000000000 --- a/cpan/Test-Simple/t/Builder/try.t +++ /dev/null @@ -1,42 +0,0 @@ -#!perl -w - -BEGIN { - if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); - } - else { - unshift @INC, 't/lib'; - } -} - -use strict; - -use Test::More 'no_plan'; - -require Test::Builder; -my $tb = Test::Builder->new; - - -# Test that _try() has no effect on $@ and $! and is not effected by -# __DIE__ -{ - local $SIG{__DIE__} = sub { fail("DIE handler called: @_") }; - local $@ = 42; - local $! = 23; - - is $tb->_try(sub { 2 }), 2; - is $tb->_try(sub { return '' }), ''; - - is $tb->_try(sub { die; }), undef; - - is_deeply [$tb->_try(sub { die "Foo\n" })], [undef, "Foo\n"]; - - is $@, 42; - cmp_ok $!, '==', 23; -} - -ok !eval { - $tb->_try(sub { die "Died\n" }, die_on_fail => 1); -}; -is $@, "Died\n"; diff --git a/cpan/Test-Simple/t/BEGIN_require_ok.t b/cpan/Test-Simple/t/Legacy/BEGIN_require_ok.t index 733d0bb861..733d0bb861 100644 --- a/cpan/Test-Simple/t/BEGIN_require_ok.t +++ b/cpan/Test-Simple/t/Legacy/BEGIN_require_ok.t diff --git a/cpan/Test-Simple/t/BEGIN_use_ok.t b/cpan/Test-Simple/t/Legacy/BEGIN_use_ok.t index 476badf7a2..476badf7a2 100644 --- a/cpan/Test-Simple/t/BEGIN_use_ok.t +++ b/cpan/Test-Simple/t/Legacy/BEGIN_use_ok.t diff --git a/cpan/Test-Simple/t/Builder/Builder.t b/cpan/Test-Simple/t/Legacy/Builder/Builder.t index a5bfd155a6..a5bfd155a6 100644 --- a/cpan/Test-Simple/t/Builder/Builder.t +++ b/cpan/Test-Simple/t/Legacy/Builder/Builder.t diff --git a/cpan/Test-Simple/t/Builder/carp.t b/cpan/Test-Simple/t/Legacy/Builder/carp.t index e89eeebfb9..b6b5518d66 100644 --- a/cpan/Test-Simple/t/Builder/carp.t +++ b/cpan/Test-Simple/t/Legacy/Builder/carp.t @@ -1,4 +1,6 @@ #!/usr/bin/perl +use strict; +use warnings; BEGIN { if( $ENV{PERL_CORE} ) { @@ -11,14 +13,13 @@ BEGIN { use Test::More tests => 3; use Test::Builder; -my $tb = Test::Builder->create; -sub foo { $tb->croak("foo") } -sub bar { $tb->carp("bar") } +sub foo { my $ctx = context(); Test::Builder->new->croak("foo") } +sub bar { my $ctx = context(); Test::Builder->new->carp("bar") } eval { foo() }; is $@, sprintf "foo at %s line %s.\n", $0, __LINE__ - 1; -eval { $tb->croak("this") }; +eval { Test::Builder->new->croak("this") }; is $@, sprintf "this at %s line %s.\n", $0, __LINE__ - 1; { diff --git a/cpan/Test-Simple/t/Builder/create.t b/cpan/Test-Simple/t/Legacy/Builder/create.t index 64be8511d8..64be8511d8 100644 --- a/cpan/Test-Simple/t/Builder/create.t +++ b/cpan/Test-Simple/t/Legacy/Builder/create.t diff --git a/cpan/Test-Simple/t/Builder/current_test.t b/cpan/Test-Simple/t/Legacy/Builder/current_test.t index edd201c0e9..edd201c0e9 100644 --- a/cpan/Test-Simple/t/Builder/current_test.t +++ b/cpan/Test-Simple/t/Legacy/Builder/current_test.t diff --git a/cpan/Test-Simple/t/Builder/current_test_without_plan.t b/cpan/Test-Simple/t/Legacy/Builder/current_test_without_plan.t index 31f9589977..31f9589977 100644 --- a/cpan/Test-Simple/t/Builder/current_test_without_plan.t +++ b/cpan/Test-Simple/t/Legacy/Builder/current_test_without_plan.t diff --git a/cpan/Test-Simple/t/Builder/details.t b/cpan/Test-Simple/t/Legacy/Builder/details.t index 05d4828b4d..05d4828b4d 100644 --- a/cpan/Test-Simple/t/Builder/details.t +++ b/cpan/Test-Simple/t/Legacy/Builder/details.t diff --git a/cpan/Test-Simple/t/Builder/done_testing.t b/cpan/Test-Simple/t/Legacy/Builder/done_testing.t index 14a8f918b0..14a8f918b0 100644 --- a/cpan/Test-Simple/t/Builder/done_testing.t +++ b/cpan/Test-Simple/t/Legacy/Builder/done_testing.t diff --git a/cpan/Test-Simple/t/Builder/done_testing_double.t b/cpan/Test-Simple/t/Legacy/Builder/done_testing_double.t index 3a0bae247b..3a0bae247b 100644 --- a/cpan/Test-Simple/t/Builder/done_testing_double.t +++ b/cpan/Test-Simple/t/Legacy/Builder/done_testing_double.t diff --git a/cpan/Test-Simple/t/Builder/done_testing_plan_mismatch.t b/cpan/Test-Simple/t/Legacy/Builder/done_testing_plan_mismatch.t index 8208635359..8208635359 100644 --- a/cpan/Test-Simple/t/Builder/done_testing_plan_mismatch.t +++ b/cpan/Test-Simple/t/Legacy/Builder/done_testing_plan_mismatch.t diff --git a/cpan/Test-Simple/t/Builder/done_testing_with_no_plan.t b/cpan/Test-Simple/t/Legacy/Builder/done_testing_with_no_plan.t index ff5f40c197..ff5f40c197 100644 --- a/cpan/Test-Simple/t/Builder/done_testing_with_no_plan.t +++ b/cpan/Test-Simple/t/Legacy/Builder/done_testing_with_no_plan.t diff --git a/cpan/Test-Simple/t/Builder/done_testing_with_number.t b/cpan/Test-Simple/t/Legacy/Builder/done_testing_with_number.t index c21458f54e..c21458f54e 100644 --- a/cpan/Test-Simple/t/Builder/done_testing_with_number.t +++ b/cpan/Test-Simple/t/Legacy/Builder/done_testing_with_number.t diff --git a/cpan/Test-Simple/t/Builder/done_testing_with_plan.t b/cpan/Test-Simple/t/Legacy/Builder/done_testing_with_plan.t index c0a3d0f014..2d10322eea 100644 --- a/cpan/Test-Simple/t/Builder/done_testing_with_plan.t +++ b/cpan/Test-Simple/t/Legacy/Builder/done_testing_with_plan.t @@ -5,7 +5,7 @@ use strict; use Test::Builder; my $tb = Test::Builder->new; -$tb->plan( tests => 2 ); +$tb->plan(tests => 2); $tb->ok(1); $tb->ok(1); $tb->done_testing(2); diff --git a/cpan/Test-Simple/t/Legacy/Builder/fork_with_new_stdout.t b/cpan/Test-Simple/t/Legacy/Builder/fork_with_new_stdout.t new file mode 100644 index 0000000000..5e20d8126e --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/Builder/fork_with_new_stdout.t @@ -0,0 +1,60 @@ +#!perl -w +use strict; +use warnings; +use IO::Pipe; +use Test::Builder; +use Config; + +my $b = Test::Builder->new; +$b->reset; + +my $Can_Fork = $Config{d_fork} + || (($^O eq 'MSWin32' || $^O eq 'NetWare') + and $Config{useithreads} + and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/); + +if (!$Can_Fork) { + $b->plan('skip_all' => "This system cannot fork"); +} +elsif ($^O eq 'MSWin32' && $] == 5.010000) { + $b->plan('skip_all' => "5.10 has fork/threading issues that break fork on win32"); +} +else { + $b->plan('tests' => 2); +} + +my $pipe = IO::Pipe->new; +if (my $pid = fork) { + $pipe->reader; + my @output = <$pipe>; + $b->like($output[0], qr/ok 1/, "ok 1 from child"); + $b->like($output[1], qr/1\.\.1/, "got 1..1 from child"); + waitpid($pid, 0); +} +else { + Test::Stream::IOSets->hard_reset; + Test::Stream->clear; + $pipe->writer; + my $pipe_fd = $pipe->fileno; + close STDOUT; + open(STDOUT, ">&$pipe_fd"); + my $b = Test::Builder->create(shared_stream => 1); + $b->reset; + $b->no_plan; + $b->ok(1); + + exit 0; +} + +=pod +#actual +1..2 +ok 1 +1..1 +ok 1 +ok 2 +#expected +1..2 +ok 1 +ok 2 +=cut diff --git a/cpan/Test-Simple/t/Builder/has_plan.t b/cpan/Test-Simple/t/Legacy/Builder/has_plan.t index d0be86a97a..d0be86a97a 100644 --- a/cpan/Test-Simple/t/Builder/has_plan.t +++ b/cpan/Test-Simple/t/Legacy/Builder/has_plan.t diff --git a/cpan/Test-Simple/t/Builder/has_plan2.t b/cpan/Test-Simple/t/Legacy/Builder/has_plan2.t index e13ea4af94..e13ea4af94 100644 --- a/cpan/Test-Simple/t/Builder/has_plan2.t +++ b/cpan/Test-Simple/t/Legacy/Builder/has_plan2.t diff --git a/cpan/Test-Simple/t/Builder/is_fh.t b/cpan/Test-Simple/t/Legacy/Builder/is_fh.t index 0eb3ec0b15..f7a5f1a80d 100644 --- a/cpan/Test-Simple/t/Builder/is_fh.t +++ b/cpan/Test-Simple/t/Legacy/Builder/is_fh.t @@ -41,7 +41,7 @@ package Lying::isa; sub isa { my $self = shift; my $parent = shift; - + return 1 if $parent eq 'IO::Handle'; } diff --git a/cpan/Test-Simple/t/Builder/is_passing.t b/cpan/Test-Simple/t/Legacy/Builder/is_passing.t index d335aada57..d335aada57 100644 --- a/cpan/Test-Simple/t/Builder/is_passing.t +++ b/cpan/Test-Simple/t/Legacy/Builder/is_passing.t diff --git a/cpan/Test-Simple/t/Builder/maybe_regex.t b/cpan/Test-Simple/t/Legacy/Builder/maybe_regex.t index d1927a56e5..fd8b8d06ed 100644 --- a/cpan/Test-Simple/t/Builder/maybe_regex.t +++ b/cpan/Test-Simple/t/Legacy/Builder/maybe_regex.t @@ -23,7 +23,7 @@ ok(('bar' !~ /$r/), 'qr// bad match'); SKIP: { skip "blessed regex checker added in 5.10", 3 if $] < 5.010; - + my $obj = bless qr/foo/, 'Wibble'; my $re = $Test->maybe_regex($obj); ok( defined $re, "blessed regex detected" ); diff --git a/cpan/Test-Simple/t/Builder/no_diag.t b/cpan/Test-Simple/t/Legacy/Builder/no_diag.t index 6fa538a82e..6fa538a82e 100644 --- a/cpan/Test-Simple/t/Builder/no_diag.t +++ b/cpan/Test-Simple/t/Legacy/Builder/no_diag.t diff --git a/cpan/Test-Simple/t/Builder/no_ending.t b/cpan/Test-Simple/t/Legacy/Builder/no_ending.t index 03e0cc489d..03e0cc489d 100644 --- a/cpan/Test-Simple/t/Builder/no_ending.t +++ b/cpan/Test-Simple/t/Legacy/Builder/no_ending.t diff --git a/cpan/Test-Simple/t/Builder/no_header.t b/cpan/Test-Simple/t/Legacy/Builder/no_header.t index 93e6bec34c..93e6bec34c 100644 --- a/cpan/Test-Simple/t/Builder/no_header.t +++ b/cpan/Test-Simple/t/Legacy/Builder/no_header.t diff --git a/cpan/Test-Simple/t/Builder/no_plan_at_all.t b/cpan/Test-Simple/t/Legacy/Builder/no_plan_at_all.t index 64a0e19476..64a0e19476 100644 --- a/cpan/Test-Simple/t/Builder/no_plan_at_all.t +++ b/cpan/Test-Simple/t/Legacy/Builder/no_plan_at_all.t diff --git a/cpan/Test-Simple/t/Builder/ok_obj.t b/cpan/Test-Simple/t/Legacy/Builder/ok_obj.t index 8678dbff8d..8678dbff8d 100644 --- a/cpan/Test-Simple/t/Builder/ok_obj.t +++ b/cpan/Test-Simple/t/Legacy/Builder/ok_obj.t diff --git a/cpan/Test-Simple/t/Builder/output.t b/cpan/Test-Simple/t/Legacy/Builder/output.t index 77e0e0bbb3..77e0e0bbb3 100644 --- a/cpan/Test-Simple/t/Builder/output.t +++ b/cpan/Test-Simple/t/Legacy/Builder/output.t diff --git a/cpan/Test-Simple/t/Builder/reset.t b/cpan/Test-Simple/t/Legacy/Builder/reset.t index 3bc44457fc..fd11db71b2 100644 --- a/cpan/Test-Simple/t/Builder/reset.t +++ b/cpan/Test-Simple/t/Legacy/Builder/reset.t @@ -13,7 +13,6 @@ BEGIN { } chdir 't'; - use Test::Builder; my $Test = Test::Builder->new; my $tb = Test::Builder->create; @@ -56,7 +55,6 @@ $Test->is_eq( $tb->expected_tests, 0, 'expected_tests' ); $Test->is_eq( $tb->level, 1, 'level' ); $Test->is_eq( $tb->use_numbers, 1, 'use_numbers' ); $Test->is_eq( $tb->no_header, 0, 'no_header' ); -$Test->is_eq( $tb->no_ending, 0, 'no_ending' ); $Test->is_eq( $tb->current_test, 0, 'current_test' ); $Test->is_eq( scalar $tb->summary, 0, 'summary' ); $Test->is_eq( scalar $tb->details, 0, 'details' ); @@ -70,7 +68,6 @@ $Test->is_eq( fileno $tb->todo_output, # The reset Test::Builder will take over from here. $Test->no_ending(1); - $tb->current_test($Test->current_test); $tb->level(0); $tb->ok(1, 'final test to make sure output was reset'); diff --git a/cpan/Test-Simple/t/Legacy/Builder/reset_outputs.t b/cpan/Test-Simple/t/Legacy/Builder/reset_outputs.t new file mode 100644 index 0000000000..b199128ad3 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/Builder/reset_outputs.t @@ -0,0 +1,35 @@ +#!perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use Test::Builder; +use Test::More 'no_plan'; + +{ + my $tb = Test::Builder->create(); + + # Store the original output filehandles and change them all. + my %original_outputs; + + open my $fh, ">", "dummy_file.tmp"; + END { 1 while unlink "dummy_file.tmp"; } + for my $method (qw(output failure_output todo_output)) { + $original_outputs{$method} = $tb->$method(); + $tb->$method($fh); + is $tb->$method(), $fh; + } + + $tb->reset_outputs; + + for my $method (qw(output failure_output todo_output)) { + is $tb->$method(), $original_outputs{$method}, "reset_outputs() resets $method"; + } +} diff --git a/cpan/Test-Simple/t/More.t b/cpan/Test-Simple/t/Legacy/More.t index ce535e26d9..b4f680bb31 100644 --- a/cpan/Test-Simple/t/More.t +++ b/cpan/Test-Simple/t/Legacy/More.t @@ -9,6 +9,7 @@ BEGIN { use lib 't/lib'; use Test::More tests => 54; +use Test::Builder; # Make sure we don't mess with $@ or $!. Test at bottom. my $Err = "this should not be touched"; @@ -40,7 +41,7 @@ unlike(@foo, '/foo/'); can_ok('Test::More', qw(require_ok use_ok ok is isnt like skip can_ok pass fail eq_array eq_hash eq_set)); -can_ok(bless({}, "Test::More"), qw(require_ok use_ok ok is isnt like skip +can_ok(bless({}, "Test::More"), qw(require_ok use_ok ok is isnt like skip can_ok pass fail eq_array eq_hash eq_set)); @@ -54,7 +55,7 @@ isa_ok(\42, 'SCALAR'); } -# can_ok() & isa_ok should call can() & isa() on the given object, not +# can_ok() & isa_ok should call can() & isa() on the given object, not # just class, in case of custom can() { local *Foo::can; @@ -143,7 +144,7 @@ ok( !eq_hash(\%hash1, \%hash2), 'eq_hash with slightly different complicated hashes' ); is @Test::More::Data_Stack, 0; -is( Test::Builder->new, Test::More->builder, 'builder()' ); +is( Test::Builder->new, Test::More->builder, 'builder()' ); cmp_ok(42, '==', 42, 'cmp_ok =='); diff --git a/cpan/Test-Simple/t/Legacy/PerlIO.t b/cpan/Test-Simple/t/Legacy/PerlIO.t new file mode 100644 index 0000000000..84ba649b37 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/PerlIO.t @@ -0,0 +1,11 @@ +use Test::More; +require PerlIO; + +my $ok = 1; +my %counts; +for my $layer (PerlIO::get_layers(Test::Stream->shared->io_sets->{legacy}->[0])) { + my $dup = $counts{$layer}++; + ok(!$dup, "No IO layer duplication '$layer'"); +} + +done_testing; diff --git a/cpan/Test-Simple/t/Simple/load.t b/cpan/Test-Simple/t/Legacy/Simple/load.t index 938569a5b8..938569a5b8 100644 --- a/cpan/Test-Simple/t/Simple/load.t +++ b/cpan/Test-Simple/t/Legacy/Simple/load.t diff --git a/cpan/Test-Simple/t/Legacy/TestTester/auto.t b/cpan/Test-Simple/t/Legacy/TestTester/auto.t new file mode 100644 index 0000000000..45510f3f06 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/TestTester/auto.t @@ -0,0 +1,32 @@ +use strict; +use warnings; + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use Test::Tester tests => 4; + +use SmallTest; + +use MyTest; + +{ + my ($prem, @results) = run_tests(sub { MyTest::ok(1, "run pass") }); + + is_eq($results[0]->{name}, "run pass"); + is_num($results[0]->{ok}, 1); +} + +{ + my ($prem, @results) = run_tests(sub { MyTest::ok(0, "run fail") }); + + is_eq($results[0]->{name}, "run fail"); + is_num($results[0]->{ok}, 0); +} diff --git a/cpan/Test-Simple/t/Legacy/TestTester/check_tests.t b/cpan/Test-Simple/t/Legacy/TestTester/check_tests.t new file mode 100644 index 0000000000..96b8470329 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/TestTester/check_tests.t @@ -0,0 +1,116 @@ +use strict; + +use Test::Tester; + +use Data::Dumper qw(Dumper); + +my $test = Test::Builder->new; +$test->plan(tests => 105); + +my $cap; + +$cap = $test; + +my @tests = ( + [ + 'pass', + '$cap->ok(1, "pass");', + { + name => "pass", + ok => 1, + actual_ok => 1, + reason => "", + type => "", + diag => "", + depth => 0, + }, + ], + [ + 'pass diag', + '$cap->ok(1, "pass diag"); + $cap->diag("pass diag1"); + $cap->diag("pass diag2");', + { + name => "pass diag", + ok => 1, + actual_ok => 1, + reason => "", + type => "", + diag => "pass diag1\npass diag2\n", + depth => 0, + }, + ], + [ + 'pass diag no \\n', + '$cap->ok(1, "pass diag"); + $cap->diag("pass diag1"); + $cap->diag("pass diag2");', + { + name => "pass diag", + ok => 1, + actual_ok => 1, + reason => "", + type => "", + diag => "pass diag1\npass diag2", + depth => 0, + }, + ], + [ + 'fail', + '$cap->ok(0, "fail"); + $cap->diag("fail diag");', + { + name => "fail", + ok => 0, + actual_ok => 0, + reason => "", + type => "", + diag => "fail diag\n", + depth => 0, + }, + ], + [ + 'skip', + '$cap->skip("just because");', + { + name => "", + ok => 1, + actual_ok => 1, + reason => "just because", + type => "skip", + diag => "", + depth => 0, + }, + ], + [ + 'todo_skip', + '$cap->todo_skip("why not");', + { + name => "", + ok => 1, + actual_ok => 0, + reason => "why not", + type => "todo_skip", + diag => "", + depth => 0, + }, + ], +); + +my $big_code = ""; +my @big_expect; + +foreach my $test (@tests) { + my ($name, $code, $expect) = @$test; + + $big_code .= "$code\n"; + push(@big_expect, $expect); + + my $test_sub = eval "sub {$code}"; + + check_test($test_sub, $expect, $name); +} + +my $big_test_sub = eval "sub {$big_code}"; + +check_tests($big_test_sub, \@big_expect, "run all"); diff --git a/cpan/Test-Simple/t/Legacy/TestTester/depth.t b/cpan/Test-Simple/t/Legacy/TestTester/depth.t new file mode 100644 index 0000000000..53ba7e0779 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/TestTester/depth.t @@ -0,0 +1,39 @@ +use strict; +use warnings; + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use Test::Tester; + +use MyTest; + +my $test = Test::Builder->new; +$test->plan(tests => 2); + +sub deeper +{ + MyTest::ok(1); +} + +{ + + my @results = run_tests( + sub { + MyTest::ok(1); + deeper(); + } + ); + + local $Test::Builder::Level = 0; + $test->is_num($results[1]->{depth}, 1, "depth 1"); + $test->is_num($results[2]->{depth}, 2, "deeper"); +} + diff --git a/cpan/Test-Simple/t/Legacy/TestTester/is_bug.t b/cpan/Test-Simple/t/Legacy/TestTester/is_bug.t new file mode 100644 index 0000000000..64642fca2a --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/TestTester/is_bug.t @@ -0,0 +1,31 @@ +use strict; +use warnings; +use Test::Tester; +use Test::More; + +check_test( + sub { is "Foo", "Foo" }, + {ok => 1}, +); + +check_test( + sub { is "Bar", "Bar" }, + {ok => 1}, +); + +check_test( + sub { is "Baz", "Quux" }, + {ok => 0}, +); + +check_test( + sub { like "Baz", qr/uhg/ }, + {ok => 0}, +); + +check_test( + sub { like "Baz", qr/a/ }, + {ok => 1}, +); + +done_testing(); diff --git a/cpan/Test-Simple/t/Legacy/TestTester/run_test.t b/cpan/Test-Simple/t/Legacy/TestTester/run_test.t new file mode 100644 index 0000000000..6b1464c358 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/TestTester/run_test.t @@ -0,0 +1,145 @@ +use strict; + +use Test::Tester; + +use Data::Dumper qw(Dumper); + +my $test = Test::Builder->new; +$test->plan(tests => 54); + +my $cap; + +{ + $cap = $test; + my ($prem, @results) = run_tests( + sub {$cap->ok(1, "run pass")} + ); + + local $Test::Builder::Level = 0; + + $test->is_eq($prem, "", "run pass no prem"); + $test->is_num(scalar (@results), 1, "run pass result count"); + + my $res = $results[0]; + + $test->is_eq($res->{name}, "run pass", "run pass name"); + $test->is_eq($res->{ok}, 1, "run pass ok"); + $test->is_eq($res->{actual_ok}, 1, "run pass actual_ok"); + $test->is_eq($res->{reason}, "", "run pass reason"); + $test->is_eq($res->{type}, "", "run pass type"); + $test->is_eq($res->{diag}, "", "run pass diag"); + $test->is_num($res->{depth}, 0, "run pass depth"); +} + +{ + my ($prem, @results) = run_tests( + sub {$cap->ok(0, "run fail")} + ); + + local $Test::Builder::Level = 0; + + $test->is_eq($prem, "", "run fail no prem"); + $test->is_num(scalar (@results), 1, "run fail result count"); + + my $res = $results[0]; + + $test->is_eq($res->{name}, "run fail", "run fail name"); + $test->is_eq($res->{actual_ok}, 0, "run fail actual_ok"); + $test->is_eq($res->{ok}, 0, "run fail ok"); + $test->is_eq($res->{reason}, "", "run fail reason"); + $test->is_eq($res->{type}, "", "run fail type"); + $test->is_eq($res->{diag}, "", "run fail diag"); + $test->is_num($res->{depth}, 0, "run fail depth"); +} + +{ + my ($prem, @results) = run_tests( + sub {$cap->skip("just because")} + ); + + local $Test::Builder::Level = 0; + + $test->is_eq($prem, "", "skip no prem"); + $test->is_num(scalar (@results), 1, "skip result count"); + + my $res = $results[0]; + + $test->is_eq($res->{name}, "", "skip name"); + $test->is_eq($res->{actual_ok}, 1, "skip actual_ok"); + $test->is_eq($res->{ok}, 1, "skip ok"); + $test->is_eq($res->{reason}, "just because", "skip reason"); + $test->is_eq($res->{type}, "skip", "skip type"); + $test->is_eq($res->{diag}, "", "skip diag"); + $test->is_num($res->{depth}, 0, "skip depth"); +} + +{ + my ($prem, @results) = run_tests( + sub {$cap->todo_skip("just because")} + ); + + local $Test::Builder::Level = 0; + + $test->is_eq($prem, "", "todo_skip no prem"); + $test->is_num(scalar (@results), 1, "todo_skip result count"); + + my $res = $results[0]; + + $test->is_eq($res->{name}, "", "todo_skip name"); + $test->is_eq($res->{actual_ok}, 0, "todo_skip actual_ok"); + $test->is_eq($res->{ok}, 1, "todo_skip ok"); + $test->is_eq($res->{reason}, "just because", "todo_skip reason"); + $test->is_eq($res->{type}, "todo_skip", "todo_skip type"); + $test->is_eq($res->{diag}, "", "todo_skip diag"); + $test->is_num($res->{depth}, 0, "todo_skip depth"); +} + +{ + my ($prem, @results) = run_tests( + sub {$cap->diag("run diag")} + ); + + local $Test::Builder::Level = 0; + + $test->is_eq($prem, "run diag\n", "run diag prem"); + $test->is_num(scalar (@results), 0, "run diag result count"); +} + +{ + my ($prem, @results) = run_tests( + sub { + $cap->ok(1, "multi pass"); + $cap->diag("multi pass diag1"); + $cap->diag("multi pass diag2"); + $cap->ok(0, "multi fail"); + $cap->diag("multi fail diag"); + } + ); + + local $Test::Builder::Level = 0; + + $test->is_eq($prem, "", "run multi no prem"); + $test->is_num(scalar (@results), 2, "run multi result count"); + + my $res_pass = $results[0]; + + $test->is_eq($res_pass->{name}, "multi pass", "run multi pass name"); + $test->is_eq($res_pass->{actual_ok}, 1, "run multi pass actual_ok"); + $test->is_eq($res_pass->{ok}, 1, "run multi pass ok"); + $test->is_eq($res_pass->{reason}, "", "run multi pass reason"); + $test->is_eq($res_pass->{type}, "", "run multi pass type"); + $test->is_eq($res_pass->{diag}, "multi pass diag1\nmulti pass diag2\n", + "run multi pass diag"); + $test->is_num($res_pass->{depth}, 0, "run multi pass depth"); + + my $res_fail = $results[1]; + + $test->is_eq($res_fail->{name}, "multi fail", "run multi fail name"); + $test->is_eq($res_pass->{actual_ok}, 1, "run multi fail actual_ok"); + $test->is_eq($res_fail->{ok}, 0, "run multi fail ok"); + $test->is_eq($res_pass->{reason}, "", "run multi fail reason"); + $test->is_eq($res_pass->{type}, "", "run multi fail type"); + $test->is_eq($res_fail->{diag}, "multi fail diag\n", "run multi fail diag"); + $test->is_num($res_pass->{depth}, 0, "run multi fail depth"); +} + diff --git a/cpan/Test-Simple/t/Tester/tbt_01basic.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_01basic.t index 62820741c2..1b4b556d3f 100644 --- a/cpan/Test-Simple/t/Tester/tbt_01basic.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_01basic.t @@ -51,7 +51,7 @@ test_test("testing failing on the same line with the same name"); test_out("not ok 1 - name # TODO Something"); test_out("# Failed (TODO) test ($0 at line 56)"); -TODO: { +TODO: { local $TODO = "Something"; fail("name"); } diff --git a/cpan/Test-Simple/t/Tester/tbt_02fhrestore.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_02fhrestore.t index e37357171b..c7826cdf1d 100644 --- a/cpan/Test-Simple/t/Tester/tbt_02fhrestore.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_02fhrestore.t @@ -7,9 +7,9 @@ use Symbol; # create temporary file handles that still point indirectly # to the right place -my $orig_o = gensym; +my $orig_o = gensym; my $orig_t = gensym; -my $orig_f = gensym; +my $orig_f = gensym; tie *$orig_o, "My::Passthru", \*STDOUT; tie *$orig_t, "My::Passthru", \*STDERR; diff --git a/cpan/Test-Simple/t/Tester/tbt_03die.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_03die.t index b9dba801eb..b9dba801eb 100644 --- a/cpan/Test-Simple/t/Tester/tbt_03die.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_03die.t diff --git a/cpan/Test-Simple/t/Tester/tbt_04line_num.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_04line_num.t index 9e8365acbf..9e8365acbf 100644 --- a/cpan/Test-Simple/t/Tester/tbt_04line_num.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_04line_num.t diff --git a/cpan/Test-Simple/t/Tester/tbt_05faildiag.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_05faildiag.t index 59ad721240..59ad721240 100644 --- a/cpan/Test-Simple/t/Tester/tbt_05faildiag.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_05faildiag.t diff --git a/cpan/Test-Simple/t/Tester/tbt_06errormess.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_06errormess.t index b02b617293..f68cba4e42 100644 --- a/cpan/Test-Simple/t/Tester/tbt_06errormess.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_06errormess.t @@ -64,7 +64,7 @@ sub my_test_test my $text = shift; local $^W = 0; - # reset the outputs + # reset the outputs $t->output($original_output_handle); $t->failure_output($original_failure_handle); $t->todo_output($original_todo_handle); diff --git a/cpan/Test-Simple/t/Tester/tbt_07args.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_07args.t index 9542d755f4..0e322128dc 100644 --- a/cpan/Test-Simple/t/Tester/tbt_07args.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_07args.t @@ -64,7 +64,7 @@ sub my_test_test my $text = shift; local $^W = 0; - # reset the outputs + # reset the outputs $t->output($original_output_handle); $t->failure_output($original_failure_handle); $t->todo_output($original_todo_handle); diff --git a/cpan/Test-Simple/t/Tester/tbt_08subtest.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_08subtest.t index 6ec508f247..6ec508f247 100644 --- a/cpan/Test-Simple/t/Tester/tbt_08subtest.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_08subtest.t diff --git a/cpan/Test-Simple/t/Tester/tbt_09do.t b/cpan/Test-Simple/t/Legacy/Tester/tbt_09do.t index a0c8b8e2e5..a0c8b8e2e5 100644 --- a/cpan/Test-Simple/t/Tester/tbt_09do.t +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_09do.t diff --git a/cpan/Test-Simple/t/Tester/tbt_09do_script.pl b/cpan/Test-Simple/t/Legacy/Tester/tbt_09do_script.pl index 590a03b085..590a03b085 100644 --- a/cpan/Test-Simple/t/Tester/tbt_09do_script.pl +++ b/cpan/Test-Simple/t/Legacy/Tester/tbt_09do_script.pl diff --git a/cpan/Test-Simple/t/bad_plan.t b/cpan/Test-Simple/t/Legacy/bad_plan.t index 80e0e65bca..80e0e65bca 100644 --- a/cpan/Test-Simple/t/bad_plan.t +++ b/cpan/Test-Simple/t/Legacy/bad_plan.t diff --git a/cpan/Test-Simple/t/bail_out.t b/cpan/Test-Simple/t/Legacy/bail_out.t index 5cdc1f9969..5cdc1f9969 100644 --- a/cpan/Test-Simple/t/bail_out.t +++ b/cpan/Test-Simple/t/Legacy/bail_out.t diff --git a/cpan/Test-Simple/t/buffer.t b/cpan/Test-Simple/t/Legacy/buffer.t index 6039e4a6f7..6039e4a6f7 100644 --- a/cpan/Test-Simple/t/buffer.t +++ b/cpan/Test-Simple/t/Legacy/buffer.t diff --git a/cpan/Test-Simple/t/c_flag.t b/cpan/Test-Simple/t/Legacy/c_flag.t index a33963415e..a33963415e 100644 --- a/cpan/Test-Simple/t/c_flag.t +++ b/cpan/Test-Simple/t/Legacy/c_flag.t diff --git a/cpan/Test-Simple/t/circular_data.t b/cpan/Test-Simple/t/Legacy/circular_data.t index 2fd819e1f4..15eb6d406f 100644 --- a/cpan/Test-Simple/t/circular_data.t +++ b/cpan/Test-Simple/t/Legacy/circular_data.t @@ -59,7 +59,7 @@ ok( eq_array ([$s], [$r]) ); { # rt.cpan.org 11623 - # Make sure the circular ref checks don't get confused by a reference + # Make sure the circular ref checks don't get confused by a reference # which is simply repeating. my $a = {}; my $b = {}; diff --git a/cpan/Test-Simple/t/cmp_ok.t b/cpan/Test-Simple/t/Legacy/cmp_ok.t index c9b9f1bf65..07ed1a9f0b 100644 --- a/cpan/Test-Simple/t/cmp_ok.t +++ b/cpan/Test-Simple/t/Legacy/cmp_ok.t @@ -15,7 +15,7 @@ $TB->level(0); sub try_cmp_ok { my($left, $cmp, $right, $error) = @_; - + my %expect; if( $error ) { $expect{ok} = 0; @@ -33,7 +33,7 @@ sub try_cmp_ok { eval { $ok = cmp_ok($left, $cmp, $right, "cmp_ok"); }; $TB->is_num(!!$ok, !!$expect{ok}, " right return"); - + my $diag = $err->read; if ($@) { diff --git a/cpan/Test-Simple/t/dependents.t b/cpan/Test-Simple/t/Legacy/dependents.t index 90e8938ebe..90e8938ebe 100644 --- a/cpan/Test-Simple/t/dependents.t +++ b/cpan/Test-Simple/t/Legacy/dependents.t diff --git a/cpan/Test-Simple/t/diag.t b/cpan/Test-Simple/t/Legacy/diag.t index f5cb437d54..f5cb437d54 100644 --- a/cpan/Test-Simple/t/diag.t +++ b/cpan/Test-Simple/t/Legacy/diag.t diff --git a/cpan/Test-Simple/t/died.t b/cpan/Test-Simple/t/Legacy/died.t index b4ee2fbbff..b4ee2fbbff 100644 --- a/cpan/Test-Simple/t/died.t +++ b/cpan/Test-Simple/t/Legacy/died.t diff --git a/cpan/Test-Simple/t/dont_overwrite_die_handler.t b/cpan/Test-Simple/t/Legacy/dont_overwrite_die_handler.t index cf9f907438..51f4d08d4e 100644 --- a/cpan/Test-Simple/t/dont_overwrite_die_handler.t +++ b/cpan/Test-Simple/t/Legacy/dont_overwrite_die_handler.t @@ -16,5 +16,6 @@ BEGIN { use Test::More tests => 2; +$handler_called = 0; ok !eval { die }; is $handler_called, 1, 'existing DIE handler not overridden'; diff --git a/cpan/Test-Simple/t/eq_set.t b/cpan/Test-Simple/t/Legacy/eq_set.t index fbdc52db1f..202f3d3665 100644 --- a/cpan/Test-Simple/t/eq_set.t +++ b/cpan/Test-Simple/t/Legacy/eq_set.t @@ -23,7 +23,7 @@ ok( eq_set([1,2,[3]], [1,[3],2]) ); # bugs.perl.org 36354 my $ref = \2; ok( eq_set( [$ref, "$ref", "$ref", $ref], - ["$ref", $ref, $ref, "$ref"] + ["$ref", $ref, $ref, "$ref"] ) ); TODO: { diff --git a/cpan/Test-Simple/t/exit.t b/cpan/Test-Simple/t/Legacy/exit.t index 2b17ce06a8..ba29394fa2 100644 --- a/cpan/Test-Simple/t/exit.t +++ b/cpan/Test-Simple/t/Legacy/exit.t @@ -24,9 +24,6 @@ my $Orig_Dir = cwd; my $Perl = File::Spec->rel2abs($^X); if( $^O eq 'VMS' ) { - # VMS can't use its own $^X in a system call until almost 5.8 - $Perl = "MCR $^X" if $] < 5.007003; - # Quiet noisy 'SYS$ABORT' $Perl .= q{ -"I../lib"} if $ENV{PERL_CORE}; $Perl .= q{ -"Mvmsish=hushed"}; @@ -64,7 +61,7 @@ END { 1 while unlink "exit_map_test" } for my $exit (0..255) { # This correctly emulates Test::Builder's behavior. - my $out = qx[$Perl exit_map_test $exit]; + my $out = qx["$Perl" exit_map_test $exit]; $TB->like( $out, qr/^exit $exit\n/, "exit map test for $exit" ); $Exit_Map{$exit} = exitstatus($?); } @@ -95,7 +92,7 @@ chdir 't'; my $lib = File::Spec->catdir(qw(lib Test Simple sample_tests)); while( my($test_name, $exit_code) = each %Tests ) { my $file = File::Spec->catfile($lib, $test_name); - my $wait_stat = system(qq{$Perl -"I../blib/lib" -"I../lib" -"I../t/lib" $file}); + my $wait_stat = system(qq{"$Perl" -"I../blib/lib" -"I../lib" -"I../t/lib" $file}); my $actual_exit = exitstatus($wait_stat); if( $exit_code eq 'not zero' ) { @@ -104,7 +101,7 @@ while( my($test_name, $exit_code) = each %Tests ) { "(expected non-zero)"); } else { - $TB->is_num( $actual_exit, $Exit_Map{$exit_code}, + $TB->is_num( $actual_exit, $Exit_Map{$exit_code}, "$test_name exited with $actual_exit ". "(expected $Exit_Map{$exit_code})"); } diff --git a/cpan/Test-Simple/t/explain.t b/cpan/Test-Simple/t/Legacy/explain.t index cf2f550e95..cf2f550e95 100644 --- a/cpan/Test-Simple/t/explain.t +++ b/cpan/Test-Simple/t/Legacy/explain.t diff --git a/cpan/Test-Simple/t/extra.t b/cpan/Test-Simple/t/Legacy/extra.t index 55a0007d49..28febc3600 100644 --- a/cpan/Test-Simple/t/extra.t +++ b/cpan/Test-Simple/t/Legacy/extra.t @@ -14,7 +14,7 @@ use strict; use Test::Builder; use Test::Builder::NoOutput; -use Test::Simple; +use Test::More; my $TB = Test::Builder->new; my $test = Test::Builder::NoOutput->create; @@ -51,10 +51,13 @@ not ok 5 - Sar # at $0 line 45. END -$test->_ending(); -$TB->is_eq($test->read(), <<END); +SKIP: { + skip 'Broken with new stuff' => 1; + $test->_ending(); + $TB->is_eq($test->read(), <<' END'); # Looks like you planned 3 tests but ran 5. # Looks like you failed 2 tests of 5 run. -END + END +} $TB->done_testing(5); diff --git a/cpan/Test-Simple/t/extra_one.t b/cpan/Test-Simple/t/Legacy/extra_one.t index d77404e15d..d77404e15d 100644 --- a/cpan/Test-Simple/t/extra_one.t +++ b/cpan/Test-Simple/t/Legacy/extra_one.t diff --git a/cpan/Test-Simple/t/fail-like.t b/cpan/Test-Simple/t/Legacy/fail-like.t index 0383094913..19e748f567 100644 --- a/cpan/Test-Simple/t/fail-like.t +++ b/cpan/Test-Simple/t/Legacy/fail-like.t @@ -22,7 +22,7 @@ package My::Test; # This has to be a require or else the END block below runs before # Test::Builder's own and the ending diagnostics don't come out right. require Test::Builder; -my $TB = Test::Builder->create; +my $TB = Test::Builder->create(); $TB->plan(tests => 4); @@ -71,7 +71,5 @@ OUT } -END { - # Test::More thinks it failed. Override that. - exit(scalar grep { !$_ } $TB->summary); -} +# Test::More thinks it failed. Override that. +Test::Builder->new->no_ending(1); diff --git a/cpan/Test-Simple/t/fail-more.t b/cpan/Test-Simple/t/Legacy/fail-more.t index 5c35d49bd3..aab2d83031 100644 --- a/cpan/Test-Simple/t/fail-more.t +++ b/cpan/Test-Simple/t/Legacy/fail-more.t @@ -27,19 +27,23 @@ my $TB = Test::Builder->create; $TB->plan(tests => 80); sub like ($$;$) { + my $c = Test::Stream::Context::context(); $TB->like(@_); } sub is ($$;$) { + my $c = Test::Stream::Context::context(); $TB->is_eq(@_); } sub main::out_ok ($$) { + my $c = Test::Stream::Context::context(); $TB->is_eq( $out->read, shift ); $TB->is_eq( $err->read, shift ); } sub main::out_like ($$) { + my $c = Test::Stream::Context::context(); my($output, $failure) = @_; $TB->like( $out->read, qr/$output/ ); @@ -233,7 +237,8 @@ not ok - ARRAY->can('foo') OUT # Failed test 'ARRAY->can('foo')' # at $0 line 228. -# ARRAY->can('foo') failed +# ARRAY->can('foo') failed with an exception: +# Can't call method "can" on unblessed reference. ERR #line 238 @@ -243,7 +248,7 @@ not ok - An object of class 'Foo' isa 'Wibble' OUT # Failed test 'An object of class 'Foo' isa 'Wibble'' # at $0 line 238. -# The object of class 'Foo' isn't a 'Wibble' +# An object of class 'Foo' isn't a 'Wibble' ERR #line 248 @@ -283,7 +288,7 @@ not ok - A reference of type 'ARRAY' isa 'HASH' OUT # Failed test 'A reference of type 'ARRAY' isa 'HASH'' # at $0 line 268. -# The reference of type 'ARRAY' isn't a 'HASH' +# A reference of type 'ARRAY' isn't a 'HASH' ERR #line 278 @@ -328,7 +333,7 @@ not ok - A reference of type 'HASH' isa 'Bar' OUT # Failed test 'A reference of type 'HASH' isa 'Bar'' # at $0 line 313. -# The reference of type 'HASH' isn't a 'Bar' +# A reference of type 'HASH' isn't a 'Bar' ERR #line 323 @@ -338,7 +343,7 @@ not ok - An object of class 'Wibble' isa 'Baz' OUT # Failed test 'An object of class 'Wibble' isa 'Baz'' # at $0 line 323. -# The object of class 'Wibble' isn't a 'Baz' +# An object of class 'Wibble' isn't a 'Baz' ERR #line 333 diff --git a/cpan/Test-Simple/t/fail.t b/cpan/Test-Simple/t/Legacy/fail.t index ccf0c74893..ccf0c74893 100644 --- a/cpan/Test-Simple/t/fail.t +++ b/cpan/Test-Simple/t/Legacy/fail.t diff --git a/cpan/Test-Simple/t/fail_one.t b/cpan/Test-Simple/t/Legacy/fail_one.t index 61d7c081ff..61d7c081ff 100644 --- a/cpan/Test-Simple/t/fail_one.t +++ b/cpan/Test-Simple/t/Legacy/fail_one.t diff --git a/cpan/Test-Simple/t/filehandles.t b/cpan/Test-Simple/t/Legacy/filehandles.t index f7dad5d7ea..f7dad5d7ea 100644 --- a/cpan/Test-Simple/t/filehandles.t +++ b/cpan/Test-Simple/t/Legacy/filehandles.t diff --git a/cpan/Test-Simple/t/fork.t b/cpan/Test-Simple/t/Legacy/fork.t index 55d7aec1f9..ad02824f52 100644 --- a/cpan/Test-Simple/t/fork.t +++ b/cpan/Test-Simple/t/Legacy/fork.t @@ -12,19 +12,24 @@ use Config; my $Can_Fork = $Config{d_fork} || (($^O eq 'MSWin32' || $^O eq 'NetWare') and - $Config{useithreads} and + $Config{useithreads} and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/ ); if( !$Can_Fork ) { plan skip_all => "This system cannot fork"; } +elsif ($^O eq 'MSWin32' && $] == 5.010000) { + plan 'skip_all' => "5.10 has fork/threading issues that break fork on win32"; +} else { plan tests => 1; } -if( fork ) { # parent +my $pid = fork; +if( $pid ) { # parent pass("Only the parent should process the ending, not the child"); + waitpid($pid, 0); } else { exit; # child diff --git a/cpan/Test-Simple/t/Legacy/fork_in_subtest.t b/cpan/Test-Simple/t/Legacy/fork_in_subtest.t new file mode 100644 index 0000000000..b89cc5c19a --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/fork_in_subtest.t @@ -0,0 +1,45 @@ +use strict; +use warnings; + +use Config; + +BEGIN { + my $Can_Fork = $Config{d_fork} || + (($^O eq 'MSWin32' || $^O eq 'NetWare') and + $Config{useithreads} and + $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/ + ); + + if( !$Can_Fork ) { + require Test::More; + Test::More::plan(skip_all => "This system cannot fork"); + exit 0; + } + elsif ($^O eq 'MSWin32' && $] == 5.010000) { + require Test::More; + Test::More::plan('skip_all' => "5.10 has fork/threading issues that break fork on win32"); + exit 0; + } +} + +use Test::Stream 'enable_fork'; +use Test::More; +# This just goes to show how silly forking inside a subtest would actually +# be.... + +ok(1, "fine $$"); + +my $pid; +subtest my_subtest => sub { + ok(1, "inside 1 | $$"); + $pid = fork(); + ok(1, "inside 2 | $$"); +}; + +if($pid) { + waitpid($pid, 0); + + ok(1, "after $$"); + + done_testing; +} diff --git a/cpan/Test-Simple/t/harness_active.t b/cpan/Test-Simple/t/Legacy/harness_active.t index 7b027a7b40..bda5dae318 100644 --- a/cpan/Test-Simple/t/harness_active.t +++ b/cpan/Test-Simple/t/Legacy/harness_active.t @@ -66,7 +66,7 @@ ERR { local $ENV{HARNESS_ACTIVE} = 1; - + #line 71 fail( "this fails" ); err_ok( <<ERR ); diff --git a/cpan/Test-Simple/t/import.t b/cpan/Test-Simple/t/Legacy/import.t index 68a36138bc..68a36138bc 100644 --- a/cpan/Test-Simple/t/import.t +++ b/cpan/Test-Simple/t/Legacy/import.t diff --git a/cpan/Test-Simple/t/is_deeply_dne_bug.t b/cpan/Test-Simple/t/Legacy/is_deeply_dne_bug.t index f4578a6460..f4578a6460 100644 --- a/cpan/Test-Simple/t/is_deeply_dne_bug.t +++ b/cpan/Test-Simple/t/Legacy/is_deeply_dne_bug.t diff --git a/cpan/Test-Simple/t/is_deeply_fail.t b/cpan/Test-Simple/t/Legacy/is_deeply_fail.t index 26036fb960..b955d290f4 100644 --- a/cpan/Test-Simple/t/is_deeply_fail.t +++ b/cpan/Test-Simple/t/Legacy/is_deeply_fail.t @@ -83,7 +83,7 @@ ERR #line 88 ok !is_deeply({ this => 42 }, { this => 43 }, 'hashes with different values'); -is( $out, "not ok 3 - hashes with different values\n", +is( $out, "not ok 3 - hashes with different values\n", 'hashes with different values' ); is( $err, <<ERR, ' right diagnostic' ); # Failed test 'hashes with different values' @@ -223,7 +223,7 @@ foreach my $test (@tests) { local $SIG{__WARN__} = sub { $warning .= join '', @_; }; ok !is_deeply(@$test); - like \$warning, + like \$warning, "/^is_deeply\\(\\) takes two or three args, you gave $num_args\.\n/"; } diff --git a/cpan/Test-Simple/t/is_deeply_with_threads.t b/cpan/Test-Simple/t/Legacy/is_deeply_with_threads.t index 9908ef6608..66a6641fa7 100644 --- a/cpan/Test-Simple/t/is_deeply_with_threads.t +++ b/cpan/Test-Simple/t/Legacy/is_deeply_with_threads.t @@ -16,18 +16,27 @@ use strict; use Config; BEGIN { - unless ( $] >= 5.008001 && $Config{'useithreads'} && - eval { require threads; 'threads'->import; 1; }) - { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { print "1..0 # Skip no working threads\n"; exit 0; } - + unless ( $ENV{AUTHOR_TESTING} ) { print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; exit 0; } } + use Test::More; my $Num_Threads = 5; diff --git a/cpan/Test-Simple/t/missing.t b/cpan/Test-Simple/t/Legacy/missing.t index 3996b6de4b..3996b6de4b 100644 --- a/cpan/Test-Simple/t/missing.t +++ b/cpan/Test-Simple/t/Legacy/missing.t diff --git a/cpan/Test-Simple/t/new_ok.t b/cpan/Test-Simple/t/Legacy/new_ok.t index d53f535d1c..2579e67218 100644 --- a/cpan/Test-Simple/t/new_ok.t +++ b/cpan/Test-Simple/t/Legacy/new_ok.t @@ -39,4 +39,6 @@ use Test::More tests => 13; eval { new_ok(); }; -is $@, sprintf "new_ok() must be given at least a class at %s line %d.\n", $0, __LINE__ - 2; +my $error = $@; +$error =~ s/\.?\n.*$//gsm; +is $error, sprintf "new_ok() must be given at least a class at %s line %d", $0, __LINE__ - 4; diff --git a/cpan/Test-Simple/t/no_plan.t b/cpan/Test-Simple/t/Legacy/no_plan.t index 5f392e40e1..5f392e40e1 100644 --- a/cpan/Test-Simple/t/no_plan.t +++ b/cpan/Test-Simple/t/Legacy/no_plan.t diff --git a/cpan/Test-Simple/t/no_tests.t b/cpan/Test-Simple/t/Legacy/no_tests.t index eafa38cacc..eafa38cacc 100644 --- a/cpan/Test-Simple/t/no_tests.t +++ b/cpan/Test-Simple/t/Legacy/no_tests.t diff --git a/cpan/Test-Simple/t/note.t b/cpan/Test-Simple/t/Legacy/note.t index fb98fb4029..fb98fb4029 100644 --- a/cpan/Test-Simple/t/note.t +++ b/cpan/Test-Simple/t/Legacy/note.t diff --git a/cpan/Test-Simple/t/overload.t b/cpan/Test-Simple/t/Legacy/overload.t index a86103746b..fe9bc46e5a 100644 --- a/cpan/Test-Simple/t/overload.t +++ b/cpan/Test-Simple/t/Legacy/overload.t @@ -69,7 +69,7 @@ Test::More->builder->is_eq ($obj, "foo"); package Foo; ::is_deeply(['TestPackage'], ['TestPackage']); - ::is_deeply({'TestPackage' => 'TestPackage'}, + ::is_deeply({'TestPackage' => 'TestPackage'}, {'TestPackage' => 'TestPackage'}); ::is_deeply('TestPackage', 'TestPackage'); } diff --git a/cpan/Test-Simple/t/overload_threads.t b/cpan/Test-Simple/t/Legacy/overload_threads.t index 379e347bae..379e347bae 100644 --- a/cpan/Test-Simple/t/overload_threads.t +++ b/cpan/Test-Simple/t/Legacy/overload_threads.t diff --git a/cpan/Test-Simple/t/plan.t b/cpan/Test-Simple/t/Legacy/plan.t index 0d3ce89edb..2b6b2fdc78 100644 --- a/cpan/Test-Simple/t/plan.t +++ b/cpan/Test-Simple/t/Legacy/plan.t @@ -11,10 +11,10 @@ use Test::More; plan tests => 4; eval { plan tests => 4 }; -is( $@, sprintf("You tried to plan twice at %s line %d.\n", $0, __LINE__ - 1), +is( $@, sprintf("Tried to plan twice!\n %s line %d\n %s line %d\n", $0, __LINE__ - 2, $0, __LINE__ - 1), 'disallow double plan' ); eval { plan 'no_plan' }; -is( $@, sprintf("You tried to plan twice at %s line %d.\n", $0, __LINE__ -1), +is( $@, sprintf("Tried to plan twice!\n %s line %d\n %s line %d\n", $0, __LINE__ - 5, $0, __LINE__ - 1), 'disallow changing plan' ); pass('Just testing plan()'); diff --git a/cpan/Test-Simple/t/plan_bad.t b/cpan/Test-Simple/t/Legacy/plan_bad.t index 179356dbc1..179356dbc1 100644 --- a/cpan/Test-Simple/t/plan_bad.t +++ b/cpan/Test-Simple/t/Legacy/plan_bad.t diff --git a/cpan/Test-Simple/t/plan_is_noplan.t b/cpan/Test-Simple/t/Legacy/plan_is_noplan.t index 1e696042ef..1e696042ef 100644 --- a/cpan/Test-Simple/t/plan_is_noplan.t +++ b/cpan/Test-Simple/t/Legacy/plan_is_noplan.t diff --git a/cpan/Test-Simple/t/plan_no_plan.t b/cpan/Test-Simple/t/Legacy/plan_no_plan.t index 3111592e97..59fab4d21c 100644 --- a/cpan/Test-Simple/t/plan_no_plan.t +++ b/cpan/Test-Simple/t/Legacy/plan_no_plan.t @@ -8,6 +8,10 @@ BEGIN { use Test::More; BEGIN { + require warnings; + if( eval "warnings->can('carp')" ) { + plan skip_all => 'Modern::Open is installed, which breaks this test'; + } if( !$ENV{HARNESS_ACTIVE} && $ENV{PERL_CORE} ) { plan skip_all => "Won't work with t/TEST"; } diff --git a/cpan/Test-Simple/t/plan_shouldnt_import.t b/cpan/Test-Simple/t/Legacy/plan_shouldnt_import.t index b6eb064244..b6eb064244 100644 --- a/cpan/Test-Simple/t/plan_shouldnt_import.t +++ b/cpan/Test-Simple/t/Legacy/plan_shouldnt_import.t diff --git a/cpan/Test-Simple/t/plan_skip_all.t b/cpan/Test-Simple/t/Legacy/plan_skip_all.t index 528df5f50d..528df5f50d 100644 --- a/cpan/Test-Simple/t/plan_skip_all.t +++ b/cpan/Test-Simple/t/Legacy/plan_skip_all.t diff --git a/cpan/Test-Simple/t/Legacy/pod.t b/cpan/Test-Simple/t/Legacy/pod.t new file mode 100644 index 0000000000..ac55c162df --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/pod.t @@ -0,0 +1,7 @@ +#!/usr/bin/perl -w + +use Test::More; +plan skip_all => "POD tests skipped unless AUTHOR_TESTING is set" unless $ENV{AUTHOR_TESTING}; +my $test_pod = eval "use Test::Pod 1.00; 1"; +plan skip_all => "Test::Pod 1.00 required for testing POD" unless $test_pod; +all_pod_files_ok(); diff --git a/cpan/Test-Simple/t/require_ok.t b/cpan/Test-Simple/t/Legacy/require_ok.t index 463a007599..56d01bc108 100644 --- a/cpan/Test-Simple/t/require_ok.t +++ b/cpan/Test-Simple/t/Legacy/require_ok.t @@ -11,7 +11,7 @@ BEGIN { } use strict; -use Test::More tests => 8; +use Test::More tests => 4; # Symbol and Class::Struct are both non-XS core modules back to 5.004. # So they'll always be there. @@ -20,10 +20,3 @@ ok( $INC{'Symbol.pm'}, "require_ok MODULE" ); require_ok("Class/Struct.pm"); ok( $INC{'Class/Struct.pm'}, "require_ok FILE" ); - -# Its more trouble than its worth to try to create these filepaths to test -# through require_ok() so we cheat and use the internal logic. -ok !Test::More::_is_module_name('foo:bar'); -ok !Test::More::_is_module_name('foo/bar.thing'); -ok !Test::More::_is_module_name('Foo::Bar::'); -ok Test::More::_is_module_name('V'); diff --git a/cpan/Test-Simple/t/Legacy/ribasushi_diag.t b/cpan/Test-Simple/t/Legacy/ribasushi_diag.t new file mode 100644 index 0000000000..570ee5159b --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/ribasushi_diag.t @@ -0,0 +1,59 @@ +use strict; +use warnings; + +use Test::More; + +BEGIN { + my $has_module = eval { require SQL::Abstract::Test; 1 }; + my $required = $ENV{AUTHOR_TESTING}; + + if ($required && !$has_module) { + die "This test requires 'SQL::Abstract::Test' to be installed when AUTHOR_TESTING.\n"; + } + + unless($required) { + plan skip_all => "Only run when AUTHOR_TESTING is set"; + } +} + +{ + package Worker; + + sub do_work { + local $Test::Builder::Level = $Test::Builder::Level + 2; + shift->(); + } +} + +use SQL::Abstract::Test; +use Test::Stream::Tester; + +my $events = intercept { + local $TODO = "Not today"; + + Worker::do_work( + sub { + SQL::Abstract::Test::is_same_sql_bind( + 'buh', [], + 'bah', [1], + ); + } + ); +}; + +ok( !(grep { $_->context->in_todo ? 0 : 1 } @{$events->[0]->diag}), "All diag is todo" ); + +events_are( + $events, + check { + event ok => { + in_todo => 1, + }; + event note => { in_todo => 1 }; + event note => { in_todo => 1 }; + dir 'end'; + }, + "All events are TODO" +); + +done_testing; diff --git a/cpan/Test-Simple/t/Legacy/ribasushi_threads.t b/cpan/Test-Simple/t/Legacy/ribasushi_threads.t new file mode 100644 index 0000000000..32a7d1f0ae --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/ribasushi_threads.t @@ -0,0 +1,77 @@ +use Config; + +BEGIN { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { + print "1..0 # Skip no working threads\n"; + exit 0; + } + + unless ($ENV{AUTHOR_TESTING}) { + print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; + exit 0; + } + + if ($INC{'Devel/Cover.pm'}) { + print "1..0 # SKIP Devel::Cover does not work with threads yet\n"; + exit 0; + } +} + +use threads; + +use strict; +use warnings; + +use Test::More; + +# basic tests +{ + pass('Test starts'); + my $ct_num = Test::More->builder->current_test; + + my $newthread = async { + my $out = ''; + + #simulate a subtest to not confuse the parent TAP emission + my $tb = Test::More->builder; + $tb->reset; + + Test::More->builder->current_test(0); + for (qw/output failure_output todo_output/) { + close $tb->$_; + open($tb->$_, '>', \$out); + } + + pass("In-thread ok") for (1, 2, 3); + + done_testing; + + close $tb->$_ for (qw/output failure_output todo_output/); + sleep(1); # tasty crashes without this + + $out; + }; + die "Thread creation failed: $! $@" if !defined $newthread; + + my $out = $newthread->join; + $out =~ s/^/ /gm; + + print $out; + + # workaround for older Test::More confusing the plan under threads + Test::More->builder->current_test($ct_num); + + pass("Made it to the end"); +} + +done_testing; diff --git a/cpan/Test-Simple/t/Legacy/ribasushi_threads2.t b/cpan/Test-Simple/t/Legacy/ribasushi_threads2.t new file mode 100644 index 0000000000..c60c61e650 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/ribasushi_threads2.t @@ -0,0 +1,51 @@ +use Config; + +BEGIN { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { + print "1..0 # Skip no working threads\n"; + exit 0; + } + + unless ($ENV{AUTHOR_TESTING}) { + print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; + exit 0; + } + + if ($INC{'Devel/Cover.pm'}) { + print "1..0 # SKIP Devel::Cover does not work with threads yet\n"; + exit 0; + } +} + +use threads; + +use strict; +use warnings; + +use Test::More; + +{ + my $todo = sub { + my $out; + ok(1); + 42; + }; + + is( + threads->create($todo)->join, + 42, + "Correct result after do-er", + ); +} + +done_testing; diff --git a/cpan/Test-Simple/t/simple.t b/cpan/Test-Simple/t/Legacy/simple.t index 7297e9d6dd..7297e9d6dd 100644 --- a/cpan/Test-Simple/t/simple.t +++ b/cpan/Test-Simple/t/Legacy/simple.t diff --git a/cpan/Test-Simple/t/skip.t b/cpan/Test-Simple/t/Legacy/skip.t index f2ea9fbf20..18d5541295 100644 --- a/cpan/Test-Simple/t/skip.t +++ b/cpan/Test-Simple/t/Legacy/skip.t @@ -7,14 +7,22 @@ BEGIN { } } -use Test::More tests => 17; +BEGIN { + require warnings; + if( eval "warnings->can('carp')" ) { + require Test::More; + Test::More::plan( skip_all => 'Modern::Open is installed, which breaks this test' ); + } +} + +use Test::More tests => 16; # If we skip with the same name, Test::Harness will report it back and # we won't get lots of false bug reports. my $Why = "Just testing the skip interface."; SKIP: { - skip $Why, 2 + skip $Why, 2 unless Pigs->can('fly'); my $pig = Pigs->new; @@ -64,7 +72,7 @@ SKIP: { fail("So very failed"); } is( $warning, "skip() needs to know \$how_many tests are in the ". - "block at $0 line 56\n", + "block at $0 line 56.\n", 'skip without $how_many warning' ); } diff --git a/cpan/Test-Simple/t/skipall.t b/cpan/Test-Simple/t/Legacy/skipall.t index 5491be126e..08c8543be2 100644 --- a/cpan/Test-Simple/t/skipall.t +++ b/cpan/Test-Simple/t/Legacy/skipall.t @@ -8,7 +8,7 @@ BEGIN { else { unshift @INC, 't/lib'; } -} +} use strict; diff --git a/cpan/Test-Simple/t/Legacy/strays.t b/cpan/Test-Simple/t/Legacy/strays.t new file mode 100644 index 0000000000..02a99ab996 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/strays.t @@ -0,0 +1,27 @@ +#!/usr/bin/perl -w + +# Check that stray newlines in test output are properly handed. + +BEGIN { + print "1..0 # Skip not completed\n"; + exit 0; +} + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} +chdir 't'; + +use Test::Builder::NoOutput; +my $tb = Test::Builder::NoOutput->create; + +$tb->ok(1, "name\n"); +$tb->ok(0, "foo\nbar\nbaz"); +$tb->skip("\nmoofer"); +$tb->todo_skip("foo\n\n"); diff --git a/cpan/Test-Simple/t/subtest/args.t b/cpan/Test-Simple/t/Legacy/subtest/args.t index 8ae26baa93..d43ac5288e 100644 --- a/cpan/Test-Simple/t/subtest/args.t +++ b/cpan/Test-Simple/t/Legacy/subtest/args.t @@ -22,6 +22,7 @@ $tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ ); $tb->ok( !eval { $tb->subtest("foo") } ); $tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ ); +use Carp qw/confess/; $tb->subtest('Arg passing', sub { my $foo = shift; my $child = Test::Builder->new; diff --git a/cpan/Test-Simple/t/subtest/bail_out.t b/cpan/Test-Simple/t/Legacy/subtest/bail_out.t index 70dc9ac56f..d6b074c2cf 100644 --- a/cpan/Test-Simple/t/subtest/bail_out.t +++ b/cpan/Test-Simple/t/Legacy/subtest/bail_out.t @@ -12,7 +12,7 @@ BEGIN { my $Exit_Code; BEGIN { - *CORE::GLOBAL::exit = sub { $Exit_Code = shift; }; + *CORE::GLOBAL::exit = sub { $Exit_Code = shift; die }; } use Test::Builder; @@ -30,29 +30,34 @@ $Test->plan(tests => 2); plan tests => 4; ok 'foo'; -subtest 'bar' => sub { - plan tests => 3; - ok 'sub_foo'; - subtest 'sub_bar' => sub { +my $ok = eval { + subtest 'bar' => sub { plan tests => 3; - ok 'sub_sub_foo'; - ok 'sub_sub_bar'; - BAIL_OUT("ROCKS FALL! EVERYONE DIES!"); - ok 'sub_sub_baz'; + ok 'sub_foo'; + subtest 'sub_bar' => sub { + plan tests => 3; + ok 'sub_sub_foo'; + ok 'sub_sub_bar'; + BAIL_OUT("ROCKS FALL! EVERYONE DIES!"); + ok 'sub_sub_baz'; + }; + ok 'sub_baz'; }; - ok 'sub_baz'; + 1; }; $Test->is_eq( $output, <<'OUT' ); 1..4 ok 1 - # Subtest: bar +# Subtest: bar 1..3 ok 1 - # Subtest: sub_bar + # Subtest: sub_bar 1..3 ok 1 ok 2 + Bail out! ROCKS FALL! EVERYONE DIES! + Bail out! ROCKS FALL! EVERYONE DIES! Bail out! ROCKS FALL! EVERYONE DIES! OUT diff --git a/cpan/Test-Simple/t/subtest/basic.t b/cpan/Test-Simple/t/Legacy/subtest/basic.t index 93780a9da2..964b60d6bf 100644 --- a/cpan/Test-Simple/t/subtest/basic.t +++ b/cpan/Test-Simple/t/Legacy/subtest/basic.t @@ -15,7 +15,7 @@ use warnings; use Test::Builder::NoOutput; -use Test::More tests => 19; +use Test::More tests => 18; # Formatting may change if we're running under Test::Harness. $ENV{HARNESS_ACTIVE} = 0; @@ -169,14 +169,12 @@ END my $child = $tb->child('skippy says he loves you'); eval { $child->plan( skip_all => 'cuz I said so' ) }; ok my $error = $@, 'A child which does a "skip_all" should throw an exception'; - isa_ok $error, 'Test::Builder::Exception', '... and the exception it throws'; + isa_ok $error, 'Test::Stream::Event', '... and the exception it throws'; } subtest 'skip all', sub { plan skip_all => 'subtest with skip_all'; ok 0, 'This should never be run'; }; - is +Test::Builder->new->{Test_Results}[-1]{type}, 'skip', - 'Subtests which "skip_all" are reported as skipped tests'; } # to do tests @@ -207,7 +205,10 @@ END $tb->_ending; my $expected = <<"END"; 1..1 -not ok 1 - No tests run for subtest "Child of $0" +not ok 1 - Child of $0 +# Failed test 'Child of $0' +# at $0 line 225. +# No tests run for subtest. END like $tb->read, qr/\Q$expected/, 'Not running subtests should make the parent test fail'; diff --git a/cpan/Test-Simple/t/subtest/die.t b/cpan/Test-Simple/t/Legacy/subtest/die.t index 7965e9088b..7965e9088b 100644 --- a/cpan/Test-Simple/t/subtest/die.t +++ b/cpan/Test-Simple/t/Legacy/subtest/die.t diff --git a/cpan/Test-Simple/t/subtest/do.t b/cpan/Test-Simple/t/Legacy/subtest/do.t index 40b950184e..b034893f63 100644 --- a/cpan/Test-Simple/t/subtest/do.t +++ b/cpan/Test-Simple/t/Legacy/subtest/do.t @@ -7,7 +7,7 @@ use Test::More; pass("First"); -my $file = "t/subtest/for_do_t.test"; +my $file = "t/Legacy/subtest/for_do_t.test"; ok -e $file, "subtest test file exists"; subtest $file => sub { do $file }; diff --git a/cpan/Test-Simple/t/subtest/exceptions.t b/cpan/Test-Simple/t/Legacy/subtest/exceptions.t index 92d65b648a..c4e57a982f 100644 --- a/cpan/Test-Simple/t/subtest/exceptions.t +++ b/cpan/Test-Simple/t/Legacy/subtest/exceptions.t @@ -17,11 +17,12 @@ use Test::More tests => 7; { my $tb = Test::Builder::NoOutput->create; - $tb->child('one'); + my $child = $tb->child('one'); eval { $tb->child('two') }; my $error = $@; like $error, qr/\QYou already have a child named (one) running/, 'Trying to create a child with another one active should fail'; + $child->finalize; } { my $tb = Test::Builder::NoOutput->create; @@ -31,14 +32,17 @@ use Test::More tests => 7; my $error = $@; like $error, qr/\QCan't call finalize() with child (two) active/, '... but trying to finalize() a child with open children should fail'; + $child2->finalize; + $child->finalize; } { my $tb = Test::Builder::NoOutput->create; my $child = $tb->child('one'); - undef $child; - like $tb->read, qr/\QChild (one) exited without calling finalize()/, + eval { $child->DESTROY }; + like $@, qr/\QChild (one) exited without calling finalize()/, 'Failing to call finalize should issue an appropriate diagnostic'; ok !$tb->is_passing, '... and should cause the test suite to fail'; + $child->finalize; } { my $tb = Test::Builder::NoOutput->create; diff --git a/cpan/Test-Simple/t/subtest/for_do_t.test b/cpan/Test-Simple/t/Legacy/subtest/for_do_t.test index 413923bceb..413923bceb 100644 --- a/cpan/Test-Simple/t/subtest/for_do_t.test +++ b/cpan/Test-Simple/t/Legacy/subtest/for_do_t.test diff --git a/cpan/Test-Simple/t/subtest/fork.t b/cpan/Test-Simple/t/Legacy/subtest/fork.t index e072a4813e..76e949329b 100644 --- a/cpan/Test-Simple/t/subtest/fork.t +++ b/cpan/Test-Simple/t/Legacy/subtest/fork.t @@ -15,6 +15,9 @@ my $Can_Fork = $Config{d_fork} || if( !$Can_Fork ) { plan 'skip_all' => "This system cannot fork"; } +elsif ($^O eq 'MSWin32' && $] == 5.010000) { + plan 'skip_all' => "5.10 has fork/threading issues that break fork on win32"; +} else { plan 'tests' => 1; } @@ -33,17 +36,17 @@ subtest 'fork within subtest' => sub { is $?, 0, 'child exit status'; like $child_output, qr/^[\s#]+Child Done\s*\z/, 'child output'; - } + } else { $pipe->writer; # Force all T::B output into the pipe, for the parent # builder as well as the current subtest builder. - no warnings 'redefine'; - *Test::Builder::output = sub { $pipe }; - *Test::Builder::failure_output = sub { $pipe }; - *Test::Builder::todo_output = sub { $pipe }; - + my $builder = Test::Builder->new; + $builder->output($pipe); + $builder->failure_output($pipe); + $builder->todo_output($pipe); + diag 'Child Done'; exit 0; } diff --git a/cpan/Test-Simple/t/subtest/implicit_done.t b/cpan/Test-Simple/t/Legacy/subtest/implicit_done.t index 0963e72c59..0963e72c59 100644 --- a/cpan/Test-Simple/t/subtest/implicit_done.t +++ b/cpan/Test-Simple/t/Legacy/subtest/implicit_done.t diff --git a/cpan/Test-Simple/t/subtest/line_numbers.t b/cpan/Test-Simple/t/Legacy/subtest/line_numbers.t index 7a20a60ae6..cc9c10db4f 100644 --- a/cpan/Test-Simple/t/subtest/line_numbers.t +++ b/cpan/Test-Simple/t/Legacy/subtest/line_numbers.t @@ -26,7 +26,7 @@ $ENV{HARNESS_ACTIVE} = 0; our %line; { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..3"); test_out(" ok 1"); test_out(" not ok 2"); @@ -43,11 +43,11 @@ our %line; ok 0; BEGIN{ $line{innerfail1} = __LINE__ } ok 1; }; BEGIN{ $line{outerfail1} = __LINE__ } - + test_test("un-named inner tests"); } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..3"); test_out(" ok 1 - first is good"); test_out(" not ok 2 - second is bad"); @@ -65,7 +65,7 @@ our %line; ok 0, "second is bad"; BEGIN{ $line{innerfail2} = __LINE__ } ok 1, "third is good"; }; BEGIN{ $line{outerfail2} = __LINE__ } - + test_test("named inner tests"); } @@ -78,7 +78,7 @@ sub run_the_subtest { }; BEGIN{ $line{outerfail3} = __LINE__ } } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..3"); test_out(" ok 1 - first is good"); test_out(" not ok 2 - second is bad"); @@ -91,16 +91,17 @@ sub run_the_subtest { test_err("# at $0 line $line{outerfail3}."); run_the_subtest(); - + test_test("subtest() called from a sub"); } { - test_out( " # Subtest: namehere"); + test_out( "# Subtest: namehere"); test_out( " 1..0"); test_err( " # No tests run!"); - test_out( 'not ok 1 - No tests run for subtest "namehere"'); - test_err(q{# Failed test 'No tests run for subtest "namehere"'}); + test_out( 'not ok 1 - namehere'); + test_err(q{# Failed test 'namehere'}); test_err( "# at $0 line $line{outerfail4}."); + test_err( "# No tests run for subtest."); subtest namehere => sub { done_testing; @@ -109,7 +110,7 @@ sub run_the_subtest { test_test("lineno in 'No tests run' diagnostic"); } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..1"); test_out(" not ok 1 - foo is bar"); test_err(" # Failed test 'foo is bar'"); diff --git a/cpan/Test-Simple/t/subtest/plan.t b/cpan/Test-Simple/t/Legacy/subtest/plan.t index 7e944ab283..7e944ab283 100644 --- a/cpan/Test-Simple/t/subtest/plan.t +++ b/cpan/Test-Simple/t/Legacy/subtest/plan.t diff --git a/cpan/Test-Simple/t/subtest/predicate.t b/cpan/Test-Simple/t/Legacy/subtest/predicate.t index 4e29a426b1..73b9c81056 100644 --- a/cpan/Test-Simple/t/subtest/predicate.t +++ b/cpan/Test-Simple/t/Legacy/subtest/predicate.t @@ -40,7 +40,7 @@ sub foobar_ok ($;$) { }; } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..2"); test_out(" ok 1 - foo"); test_out(" not ok 2 - bar"); @@ -65,7 +65,7 @@ sub foobar_ok_2 ($;$) { foobar_ok($value, $name); } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..2"); test_out(" ok 1 - foo"); test_out(" not ok 2 - bar"); @@ -95,7 +95,7 @@ sub barfoo_ok ($;$) { }); } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..2"); test_out(" ok 1 - foo"); test_out(" not ok 2 - bar"); @@ -120,7 +120,7 @@ sub barfoo_ok_2 ($;$) { barfoo_ok($value, $name); } { - test_out(" # Subtest: namehere"); + test_out("# Subtest: namehere"); test_out(" 1..2"); test_out(" ok 1 - foo"); test_out(" not ok 2 - bar"); @@ -138,10 +138,10 @@ sub barfoo_ok_2 ($;$) { # A subtest-based predicate called from within a subtest { - test_out(" # Subtest: outergroup"); + test_out("# Subtest: outergroup"); test_out(" 1..2"); test_out(" ok 1 - this passes"); - test_out(" # Subtest: namehere"); + test_out(" # Subtest: namehere"); test_out(" 1..2"); test_out(" ok 1 - foo"); test_out(" not ok 2 - bar"); diff --git a/cpan/Test-Simple/t/subtest/singleton.t b/cpan/Test-Simple/t/Legacy/subtest/singleton.t index 0c25261f5b..0c25261f5b 100644 --- a/cpan/Test-Simple/t/subtest/singleton.t +++ b/cpan/Test-Simple/t/Legacy/subtest/singleton.t diff --git a/cpan/Test-Simple/t/subtest/threads.t b/cpan/Test-Simple/t/Legacy/subtest/threads.t index 0d70b1e6e5..5d053ca2db 100644 --- a/cpan/Test-Simple/t/subtest/threads.t +++ b/cpan/Test-Simple/t/Legacy/subtest/threads.t @@ -5,8 +5,8 @@ use warnings; use Config; BEGIN { - unless ( $] >= 5.008001 && $Config{'useithreads'} && - eval { require threads; 'threads'->import; 1; }) + unless ( $] >= 5.008001 && $Config{'useithreads'} && + eval { require threads; 'threads'->import; 1; }) { print "1..0 # Skip: no working threads\n"; exit 0; diff --git a/cpan/Test-Simple/t/subtest/todo.t b/cpan/Test-Simple/t/Legacy/subtest/todo.t index 7269da9b95..82de40e3da 100644 --- a/cpan/Test-Simple/t/subtest/todo.t +++ b/cpan/Test-Simple/t/Legacy/subtest/todo.t @@ -43,7 +43,8 @@ plan tests => 8 * @test_combos; sub test_subtest_in_todo { my ($name, $code, $want_out, $no_tests_run) = @_; - my $xxx = $no_tests_run ? 'No tests run for subtest "xxx"' : 'xxx'; + #my $xxx = $no_tests_run ? 'No tests run for subtest "xxx"' : 'xxx'; + my @no_test_err = $no_tests_run ? ('# No tests run for subtest.') : (); chomp $want_out; my @outlines = split /\n/, $want_out; @@ -52,14 +53,17 @@ sub test_subtest_in_todo { my ($set_via, $todo_reason, $level) = @$combo; test_out( - " # Subtest: xxx", + "# Subtest: xxx", @outlines, - "not ok 1 - $xxx # TODO $todo_reason", - "# Failed (TODO) test '$xxx'", - "# at $0 line $line{xxx}.", - "not ok 2 - regular todo test # TODO $todo_reason", - "# Failed (TODO) test 'regular todo test'", - "# at $0 line $line{reg}.", + map { my $x = $_; $x =~ s/\s+$//; $x } ( + "not ok 1 - xxx # TODO $todo_reason", + "# Failed (TODO) test 'xxx'", + "# at $0 line $line{xxx}.", + @no_test_err, + "not ok 2 - regular todo test # TODO $todo_reason", + "# Failed (TODO) test 'regular todo test'", + "# at $0 line $line{reg}.", + ) ); { @@ -77,14 +81,14 @@ sub test_subtest_in_todo { } } - test_test("$name ($level), todo [$todo_reason] set via $set_via"); + last unless test_test("$name ($level), todo [$todo_reason] set via $set_via"); } } package Foo; # If several stack frames are in package 'main' then $Level # could be wrong and $main::TODO might still be found. Using # another package makes the tests more sensitive. - + sub main::subtest_at_level { my ($name, $code, $level) = @_; diff --git a/cpan/Test-Simple/t/subtest/wstat.t b/cpan/Test-Simple/t/Legacy/subtest/wstat.t index ee2f19866d..ee2f19866d 100644 --- a/cpan/Test-Simple/t/subtest/wstat.t +++ b/cpan/Test-Simple/t/Legacy/subtest/wstat.t diff --git a/cpan/Test-Simple/t/tbm_doesnt_set_exported_to.t b/cpan/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t index 8bdd17753b..4202a69926 100644 --- a/cpan/Test-Simple/t/tbm_doesnt_set_exported_to.t +++ b/cpan/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t @@ -10,7 +10,7 @@ BEGIN { use strict; use warnings; -# Can't use Test::More, that would set exported_to() +# Can't use Test::More that would set exported_to() use Test::Builder; use Test::Builder::Module; diff --git a/cpan/Test-Simple/t/Legacy/test_use_ok.t b/cpan/Test-Simple/t/Legacy/test_use_ok.t new file mode 100644 index 0000000000..0b4b9a7d35 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/test_use_ok.t @@ -0,0 +1,40 @@ +use strict; +use Test::More; +use ok; +use ok 'strict'; +use ok 'Test::More'; +use ok 'ok'; + +my $class = 'Test::Builder'; +BEGIN { + ok(!$class, '$class is declared, but not yet set'); + + + my $success = eval 'use ok $class'; + my $error = $@; + + ok(!$success, "Threw an exception"); + like( + $error, + qr/^'use ok' called with an empty argument, did you try to use a package name from an uninitialized variable\?/, + "Threw expected exception" + ); + + + + $success = eval 'use ok $class, "xxx"'; + $error = $@; + + ok(!$success, "Threw an exception"); + like( + $error, + qr/^'use ok' called with an empty argument, did you try to use a package name from an uninitialized variable\?/, + "Threw expected exception when arguments are added" + ); +} + +my $class2; +BEGIN {$class2 = 'Test::Builder'}; +use ok $class2; + +done_testing; diff --git a/cpan/Test-Simple/t/thread_taint.t b/cpan/Test-Simple/t/Legacy/thread_taint.t index ef7b89daef..ef7b89daef 100644 --- a/cpan/Test-Simple/t/thread_taint.t +++ b/cpan/Test-Simple/t/Legacy/thread_taint.t diff --git a/cpan/Test-Simple/t/Legacy/threads.t b/cpan/Test-Simple/t/Legacy/threads.t new file mode 100644 index 0000000000..51b374d9f9 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/threads.t @@ -0,0 +1,47 @@ +#!/usr/bin/perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = '../lib'; + } +} + +use Config; + +BEGIN { + if ($] == 5.010000) { + print "1..0 # Threads are broken on 5.10.0\n"; + exit 0; + } + + my $works = 1; + $works &&= $] >= 5.008001; + $works &&= $Config{'useithreads'}; + $works &&= eval { require threads; 'threads'->import; 1 }; + + unless ($works) { + print "1..0 # Skip no working threads\n"; + exit 0; + } + + unless ( $ENV{AUTHOR_TESTING} ) { + print "1..0 # Skip many perls have broken threads. Enable with AUTHOR_TESTING.\n"; + exit 0; + } +} + +use strict; +use Test::Builder; + +my $Test = Test::Builder->new; +$Test->exported_to('main'); +$Test->plan(tests => 6); + +for(1..5) { + 'threads'->create(sub { + $Test->ok(1,"Each of these should app the test number") + })->join; +} + +$Test->is_num($Test->current_test(), 5,"Should be five"); diff --git a/cpan/Test-Simple/t/todo.t b/cpan/Test-Simple/t/Legacy/todo.t index 91861be3cb..9b5aa7583c 100644 --- a/cpan/Test-Simple/t/todo.t +++ b/cpan/Test-Simple/t/Legacy/todo.t @@ -9,6 +9,13 @@ BEGIN { use Test::More; +BEGIN { + require warnings; + if( eval "warnings->can('carp')" ) { + plan skip_all => 'Modern::Open is installed, which breaks this test'; + } +} + plan tests => 36; @@ -74,7 +81,7 @@ TODO: { fail("So very failed"); } is( $warning, "todo_skip() needs to know \$how_many tests are in the ". - "block at $0 line 74\n", + "block at $0 line 74.\n", 'todo_skip without $how_many warning' ); } @@ -82,9 +89,9 @@ my $builder = Test::More->builder; my $exported_to = $builder->exported_to; TODO: { $builder->exported_to("Wibble"); - + local $TODO = "testing \$TODO with an incorrect exported_to()"; - + fail("Just testing todo"); } @@ -137,6 +144,7 @@ is $is_todo, 'Nesting TODO', ok $in_todo, " but we're in_todo()"; } +# line 200 eval { $builder->todo_end; }; diff --git a/cpan/Test-Simple/t/undef.t b/cpan/Test-Simple/t/Legacy/undef.t index 2c8cace491..d560f8231c 100644 --- a/cpan/Test-Simple/t/undef.t +++ b/cpan/Test-Simple/t/Legacy/undef.t @@ -11,7 +11,14 @@ BEGIN { } use strict; -use Test::More tests => 21; +use Test::More; + +BEGIN { + require warnings; + if( eval "warnings->can('carp')" ) { + plan skip_all => 'Modern::Open is installed, which breaks this test'; + } +} BEGIN { $^W = 1; } @@ -36,7 +43,7 @@ sub warnings_like { my $Filename = quotemeta $0; - + is( undef, undef, 'undef is undef'); no_warnings; @@ -96,3 +103,5 @@ no_warnings; is_deeply([ undef ], [ undef ]); no_warnings; } + +done_testing; diff --git a/cpan/Test-Simple/t/use_ok.t b/cpan/Test-Simple/t/Legacy/use_ok.t index 9e858bc75e..9e858bc75e 100644 --- a/cpan/Test-Simple/t/use_ok.t +++ b/cpan/Test-Simple/t/Legacy/use_ok.t diff --git a/cpan/Test-Simple/t/useing.t b/cpan/Test-Simple/t/Legacy/useing.t index c4ce507127..c4ce507127 100644 --- a/cpan/Test-Simple/t/useing.t +++ b/cpan/Test-Simple/t/Legacy/useing.t diff --git a/cpan/Test-Simple/t/utf8.t b/cpan/Test-Simple/t/Legacy/utf8.t index f68b2a7680..2930226e3e 100644 --- a/cpan/Test-Simple/t/utf8.t +++ b/cpan/Test-Simple/t/Legacy/utf8.t @@ -43,9 +43,9 @@ SKIP: { for my $method (keys %handles) { my $src = $handles{$method}; - + my $dest = Test::More->builder->$method; - + is_deeply { map { $_ => 1 } PerlIO::get_layers($dest) }, { map { $_ => 1 } PerlIO::get_layers($src) }, "layers copied to $method"; @@ -56,7 +56,7 @@ SKIP: { # Test utf8 is ok. { my $uni = "\x{11e}"; - + my @warnings; local $SIG{__WARN__} = sub { push @warnings, @_; diff --git a/cpan/Test-Simple/t/Legacy/versions.t b/cpan/Test-Simple/t/Legacy/versions.t new file mode 100644 index 0000000000..49e146ad9c --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/versions.t @@ -0,0 +1,50 @@ +#!/usr/bin/perl -w + +# Make sure all the modules have the same version +# +# TBT has its own version system. + +use strict; +use Test::More; + +{ + local $SIG{__WARN__} = sub { 1 }; + require Test::Builder::Module; + require Test::Builder::Tester::Color; + require Test::Builder::Tester; + require Test::Builder; + require Test::More; + require Test::Simple; + require Test::Stream; + require Test::Stream::Tester; + require Test::Tester; + require Test::use::ok; + require ok; +} + +my $dist_version = Test::More->VERSION; + +like( $dist_version, qr/^ \d+ \. \d+ $/x, "Version number is sane" ); + +my @modules = qw( + Test::Builder::Module + Test::Builder::Tester::Color + Test::Builder::Tester + Test::Builder + Test::More + Test::Simple + Test::Stream + Test::Stream::Tester + Test::Tester + Test::use::ok + ok +); + +for my $module (@modules) { + my $file = $module; + $file =~ s{(::|')}{/}g; + $file .= ".pm"; + is( $module->VERSION, $module->VERSION, sprintf("%-22s %s", $module, $INC{$file}) ); +} + +done_testing(); diff --git a/cpan/Test-Simple/t/Test-Builder.t b/cpan/Test-Simple/t/Test-Builder.t new file mode 100644 index 0000000000..80d19467be --- /dev/null +++ b/cpan/Test-Simple/t/Test-Builder.t @@ -0,0 +1,10 @@ +use strict; +use warnings; + +use Test::More; + +use ok 'Test::Builder'; + +# Test::Builder is tested by the stuff in t/Legacy + +done_testing; diff --git a/cpan/Test-Simple/t/Test-More-DeepCheck.t b/cpan/Test-Simple/t/Test-More-DeepCheck.t new file mode 100644 index 0000000000..9b5bbf8f5d --- /dev/null +++ b/cpan/Test-Simple/t/Test-More-DeepCheck.t @@ -0,0 +1,7 @@ +use strict; +use warnings; + +use Test::More; +use ok 'Test::More::DeepCheck'; + +done_testing; diff --git a/cpan/Test-Simple/t/Test-More.t b/cpan/Test-Simple/t/Test-More.t new file mode 100644 index 0000000000..76e2199b88 --- /dev/null +++ b/cpan/Test-Simple/t/Test-More.t @@ -0,0 +1,29 @@ +use strict; +use warnings; + +use ok 'Test::More'; + +{ + package Foo; + use Test::More import => ['!explain']; +} + +{ + package Bar; + BEGIN { main::use_ok('Scalar::Util', 'blessed') } + BEGIN { main::can_ok('Bar', qw/blessed/) } + blessed('x'); +} + +{ + package Baz; + use Test::More; + use_ok( 'Data::Dumper' ); + can_ok( __PACKAGE__, 'Dumper' ); + Dumper({foo => 'bar'}); +} + +can_ok('Foo', qw/ok is context plan/); +ok(!Foo->can('explain'), "explain was not imported"); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-MostlyLike.t b/cpan/Test-Simple/t/Test-MostlyLike.t new file mode 100644 index 0000000000..b73a410caf --- /dev/null +++ b/cpan/Test-Simple/t/Test-MostlyLike.t @@ -0,0 +1,159 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::MostlyLike; +use Test::More; +use Test::Stream::Tester; + +use ok 'Test::MostlyLike'; + +{ + package XXX; + + sub new { bless {ref => ['a']}, shift }; + + sub numbers { 1 .. 10 }; + sub letters { 'a' .. 'e' }; + sub ref { [ 1 .. 10 ] }; +} + +events_are ( + intercept { + mostly_like( 'a', 'a', "match" ); + mostly_like( 'a', 'b', "no match" ); + + mostly_like( + [ qw/a b c/ ], + [ qw/a b c/ ], + "all match", + ); + + mostly_like( + [qw/a b c/], + { 1 => 'b' }, + "Only check one index (match)", + ); + mostly_like( + [qw/a b c/], + { 1 => 'x' }, + "Only check one index (no match)", + ); + + mostly_like( + { a => 1, b => 2, c => 3 }, + { a => 1, b => 2, c => 3 }, + "all match" + ); + + mostly_like( + { a => 1, b => 2, c => 3 }, + { b => 2, d => undef }, + "A match and an expected empty" + ); + + mostly_like( + { a => 1, b => 2, c => 3 }, + { b => undef }, + "Expect empty (fail)" + ); + + mostly_like( + { a => 'foo', b => 'bar' }, + { a => qr/o/, b => qr/a/ }, + "Regex check" + ); + + mostly_like( + { a => 'foo', b => 'bar' }, + { a => qr/o/, b => qr/o/ }, + "Regex check fail" + ); + + mostly_like( + { a => { b => { c => { d => 1 }}}}, + { a => { b => { c => { d => 1 }}}}, + "Deep match" + ); + + mostly_like( + { a => { b => { c => { d => 1 }}}}, + { a => { b => { c => { d => 2 }}}}, + "Deep mismatch" + ); + + mostly_like( + XXX->new, + { + ':ref' => ['a'], + ref => [ 1 .. 10 ], + '[numbers]' => [ 1 .. 10 ], + '[letters]' => [ 'a' .. 'e' ], + }, + "Object check" + ); + + mostly_like( + XXX->new, + { + ':ref' => ['a'], + ref => [ 1 .. 10 ], + '[numbers]' => [ 1 .. 10 ], + '[letters]' => [ 'a' .. 'e' ], + '[invalid]' => [ 'x' ], + }, + "Object check" + ); + + }, + check { + event ok => { bool => 1 }; + event ok => { + bool => 0, + diag => qr/got: 'a'.*\n.*expected: 'b'/, + }; + + event ok => { bool => 1 }; + event ok => { bool => 1 }; + + event ok => { + bool => 0, + diag => qr/\$got->\[1\] = 'b'\n\s*\$expected->\[1\] = 'x'/, + }; + + event ok => { bool => 1 }; + event ok => { bool => 1 }; + + event ok => { + bool => 0, + diag => qr/\$got->\{b\} = '2'\n\s*\$expected->\{b\} = undef/, + }; + + event ok => { bool => 1 }; + event ok => { + bool => 0, + diag => qr/\$got->\{b\} = 'bar'\n\s+\$expected->\{b\} = .*o/, + }; + + event ok => { bool => 1 }; + event ok => { + bool => 0, + diag => qr/\$got->\Q{a}{b}{c}{d}\E = '1'\n\s+\$expected->\Q{a}{b}{c}{d}\E = '2'/, + }; + + event ok => { bool => 1 }; + event ok => { + bool => 0, + diag => [ + qr/\[\s+\$got->invalid\(\)\] = '\(EXCEPTION\)'/, + qr/\[\$expected->\{invalid\}\] = ARRAY/, + qr/Can't locate object method "invalid" via package "XXX"/, + ], + }; + + directive 'end'; + }, + "Tolerant" +); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Simple.t b/cpan/Test-Simple/t/Test-Simple.t new file mode 100644 index 0000000000..8e1fe7ddb1 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Simple.t @@ -0,0 +1,24 @@ +use strict; +use warnings; + +use Test::Simple tests => 1; +use Test::Stream::Tester; + +events_are ( + intercept { + ok(1, "Pass"); + ok(0, "Fail"); + }, + check { + event ok => { + bool => 1, + name => 'Pass', + diag => '', + }; + event ok => { + bool => 0, + name => 'Fail', + diag => qr/Failed test 'Fail'/, + }; + }, +); diff --git a/cpan/Test-Simple/t/Test-Stream-ArrayBase-Meta.t b/cpan/Test-Simple/t/Test-Stream-ArrayBase-Meta.t new file mode 100644 index 0000000000..7658dbbe1d --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-ArrayBase-Meta.t @@ -0,0 +1,10 @@ +use strict; +use warnings; + +use Test::More; + +use ok 'Test::Stream::ArrayBase::Meta'; + +# This class is tested in the Test::Stream::ArrayBase tests + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-ArrayBase.t b/cpan/Test-Simple/t/Test-Stream-ArrayBase.t new file mode 100644 index 0000000000..f81f29f4cc --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-ArrayBase.t @@ -0,0 +1,97 @@ +use strict; +use warnings; + +use Test::More; +use lib 'lib'; + +BEGIN { + $INC{'My/ABase.pm'} = __FILE__; + + package My::ABase; + use Test::Stream::ArrayBase( + accessors => [qw/foo bar baz/], + ); + + use Test::More; + is(FOO, 0, "FOO CONSTANT"); + is(BAR, 1, "BAR CONSTANT"); + is(BAZ, 2, "BAZ CONSTANT"); + + my $bad = eval { Test::Stream::ArrayBase->import( accessors => [qw/foo/] ); 1 }; + my $error = $@; + ok(!$bad, "Threw exception"); + like($error, qr/field 'foo' already defined/, "Expected error"); +} + +BEGIN { + package My::ABaseSub; + use Test::Stream::ArrayBase( + accessors => [qw/apple pear/], + base => 'My::ABase', + ); + + use Test::More; + is(FOO, 0, "FOO CONSTANT"); + is(BAR, 1, "BAR CONSTANT"); + is(BAZ, 2, "BAZ CONSTANT"); + is(APPLE, 3, "APPLE CONSTANT"); + is(PEAR, 4, "PEAR CONSTANT"); + + my $bad = eval { Test::Stream::ArrayBase->import( base => 'foobarbaz' ); 1 }; + my $error = $@; + ok(!$bad, "Threw exception"); + like($error, qr/My::ABaseSub is already a subclass of 'My::ABase'/, "Expected error"); +} + +{ + package My::ABase; + my $bad = eval { Test::Stream::ArrayBase->import( accessors => [qw/xerxes/] ); 1 }; + my $error = $@; + ok(!$bad, "Threw exception"); + like($error, qr/Cannot add accessor, metadata is locked due to a subclass being initialized/, "Expected error"); +} + +{ + package Consumer; + use My::ABase qw/BAR/; + use Test::More; + + is(BAR, 1, "Can import contants"); + + my $bad = eval { Test::Stream::ArrayBase->import( base => 'Test::More' ); 1 }; + my $error = $@; + ok(!$bad, "Threw exception"); + like($error, qr/Base class 'Test::More' is not a subclass of Test::Stream::ArrayBase/, "Expected error"); +} + +isa_ok('My::ABase', 'Test::Stream::ArrayBase'); +isa_ok('My::ABaseSub', 'Test::Stream::ArrayBase'); +isa_ok('My::ABaseSub', 'My::ABase'); + +my $one = My::ABase->new(qw/a b c/); +is($one->foo, 'a', "Accessor"); +is($one->bar, 'b', "Accessor"); +is($one->baz, 'c', "Accessor"); +$one->set_foo('x'); +is($one->foo, 'x', "Accessor set"); +$one->set_foo(undef); + +is_deeply( + $one->to_hash, + { + foo => undef, + bar => 'b', + baz => 'c', + }, + 'to_hash' +); + +my $two = My::ABase->new_from_pairs( + foo => 'foo', + bar => 'bar', +); + +is($two->foo, 'foo', "set by pair"); +is($two->bar, 'bar', "set by pair"); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Carp.t b/cpan/Test-Simple/t/Test-Stream-Carp.t new file mode 100644 index 0000000000..037d23f48b --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Carp.t @@ -0,0 +1,53 @@ +use strict; +use warnings; + +# On some threaded systems this test cannot be run. +BEGIN { + require Test::Stream::Threads; + if ($INC{'Carp.pm'}) { + print "1..0 # SKIP: Carp is already loaded before we even begin.\n"; + exit 0; + } +} + +my @stack; +BEGIN { + unshift @INC => sub { + my ($ref, $filename) = @_; + return if @stack; + return unless $filename eq 'Carp.pm'; + my %seen; + my $level = 1; + while (my @call = caller($level++)) { + my ($pkg, $file, $line) = @call; + next if $seen{"$file $line"}++; + push @stack => \@call; + } + return; + }; +} + +use Test::More; + +BEGIN { + my $r = ok(!$INC{'Carp.pm'}, "Carp is not loaded when we start"); +} + +use ok 'Test::Stream::Carp', 'croak'; + +ok(!$INC{'Carp.pm'}, "Carp is not loaded"); + +if (@stack) { + my $msg = "Carp load trace:\n"; + $msg .= " $_->[1] line $_->[2]\n" for @stack; + diag $msg; +} + +my $out = eval { croak "xxx"; 1 }; +my $err = $@; +ok(!$out, "died"); +like($err, qr/xxx/, "Got carp exception"); + +ok($INC{'Carp.pm'}, "Carp is loaded now"); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Event-Diag.t b/cpan/Test-Simple/t/Test-Stream-Event-Diag.t new file mode 100644 index 0000000000..95ba48ea6e --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Event-Diag.t @@ -0,0 +1,24 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::Event::Diag'; + +my $ctx = context(-1); my $line = __LINE__; +$ctx = $ctx->snapshot; +is($ctx->line, $line, "usable context"); + +my $diag = $ctx->diag('hello'); +ok($diag, "build diag"); +isa_ok($diag, 'Test::Stream::Event::Diag'); +is($diag->message, 'hello', "message"); + +is_deeply( + [$diag->to_tap], + [[Test::Stream::Event::Diag::OUT_ERR, "# hello\n"]], + "Got tap" +); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Event-Finish.t b/cpan/Test-Simple/t/Test-Stream-Event-Finish.t new file mode 100644 index 0000000000..db396bbbf3 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Event-Finish.t @@ -0,0 +1,7 @@ +use strict; +use warnings; +use Test::More; + +use ok 'Test::Stream::Event::Finish'; + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Event-Note.t b/cpan/Test-Simple/t/Test-Stream-Event-Note.t new file mode 100644 index 0000000000..b3bd2efda2 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Event-Note.t @@ -0,0 +1,19 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::Event::Note'; + +my $note = Test::Stream::Event::Note->new('fake', 'fake', 0, "hello"); + +is($note->message, 'hello', "got message"); + +is_deeply( + [$note->to_tap], + [[Test::Stream::Event::Note::OUT_STD, "# hello\n"]], + "Got handle id and message in tap", +); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Event.t b/cpan/Test-Simple/t/Test-Stream-Event.t new file mode 100644 index 0000000000..1351059e45 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Event.t @@ -0,0 +1,30 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::Event'; + +can_ok('Test::Stream::Event', qw/context created in_subtest/); + +my $ok = eval { Test::Stream::Event->new(); 1 }; +my $err = $@; +ok(!$ok, "Died"); +like($err, qr/No context provided/, "Need context"); + +{ + package My::MockEvent; + use Test::Stream::Event( + accessors => [qw/foo bar baz/], + ); +} + +can_ok('My::MockEvent', qw/foo bar baz/); +isa_ok('My::MockEvent', 'Test::Stream::Event'); + +my $one = My::MockEvent->new('fake'); + +can_ok('Test::Stream::Context', 'mockevent'); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-ExitMagic-Context.t b/cpan/Test-Simple/t/Test-Stream-ExitMagic-Context.t new file mode 100644 index 0000000000..42e002056c --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-ExitMagic-Context.t @@ -0,0 +1,8 @@ +use strict; +use warnings; + +use Test::More; + +use ok 'Test::Stream::ExitMagic::Context'; + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Exporter-Meta.t b/cpan/Test-Simple/t/Test-Stream-Exporter-Meta.t new file mode 100644 index 0000000000..124fedd8f2 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Exporter-Meta.t @@ -0,0 +1,9 @@ +use strict; +use warnings; +use Test::More; + +use ok 'Test::Stream::Exporter::Meta'; + +# This is tested by the Test::Stream::Exporter tests. + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Exporter.t b/cpan/Test-Simple/t/Test-Stream-Exporter.t new file mode 100644 index 0000000000..1477867772 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Exporter.t @@ -0,0 +1,130 @@ +use strict; +use warnings; + +use Test::More; + +{ + package My::Exporter; + use Test::Stream::Exporter; + use Test::More; + + export a => sub { 'a' }; + default_export b => sub { 'b' }; + + export 'c'; + sub c { 'c' } + + default_export x => sub { 'x' }; + + our $export = "here"; + $main::export::xxx = 'here'; + + export '$export' => \$export; + + Test::Stream::Exporter->cleanup; + + is($export, 'here', "still have an \$export var"); + is($main::export::xxx, 'here', "still have an \$export::* var"); + + ok(!__PACKAGE__->can($_), "removed $_\()") for qw/export default_export exports default_exports/; + + my $ok = eval { + export no => sub { 'no' }; + 1; + }; + my $error = $@; + ok(!$ok, "Cannot add exports after cleanup"); + like($error, qr/Undefined subroutine &My::Exporter::export called/, "Sub was removed"); +} + +My::Exporter->import( '!x' ); + +can_ok(__PACKAGE__, qw/b/); +ok(!__PACKAGE__->can($_), "did not import $_\()") for qw/a c x/; + +My::Exporter->import(qw/a c/); +can_ok(__PACKAGE__, qw/a b c/); + +ok(!__PACKAGE__->can($_), "did not import $_\()") for qw/x/; + +My::Exporter->import(); +can_ok(__PACKAGE__, qw/a b c x/); + +is(__PACKAGE__->$_(), $_, "$_() eq '$_', Function is as expected") for qw/a b c x/; + +ok(! defined $::export, "no export scalar"); +My::Exporter->import('$export'); +is($::export, 'here', "imported export scalar"); + +use Test::Stream::Exporter qw/export_meta/; +my $meta = export_meta('My::Exporter'); +isa_ok($meta, 'Test::Stream::Exporter::Meta'); +is_deeply( + [sort $meta->default], + [sort qw/b x/], + "Got default list" +); + +is_deeply( + [sort $meta->all], + [sort qw/a b c x $export/], + "Got all list" +); + +is_deeply( + $meta->exports, + { + a => __PACKAGE__->can('a') || undef, + b => __PACKAGE__->can('b') || undef, + c => __PACKAGE__->can('c') || undef, + x => __PACKAGE__->can('x') || undef, + + '$export' => \$My::Exporter::export, + }, + "Exports are what we expect" +); + +# Make sure export_to_level us supported + +BEGIN { + package A; + + use Test::Stream::Exporter qw/import export_to_level exports/; + exports qw/foo/; + + sub foo { 'foo' } + + ############### + package B; + + sub do_it { + my $class = shift; + my ($num) = @_; + $num ||= 1; + A->export_to_level($num, $class, 'foo'); + } + + ############## + package C; + + sub do_it { + B->do_it(2); + } +} + +{ + package m1; + + BEGIN { B->do_it } +} + +{ + package m2; + + BEGIN{ C->do_it }; +} + +can_ok('m1', 'foo'); +can_ok('m2', 'foo'); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-IOSets.t b/cpan/Test-Simple/t/Test-Stream-IOSets.t new file mode 100644 index 0000000000..c2da17eca3 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-IOSets.t @@ -0,0 +1,31 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::MostlyLike; +use Test::More; + +use ok 'Test::Stream::IOSets'; + +my ($out, $err) = Test::Stream::IOSets->open_handles; +ok($out && $err, "got 2 handles"); +ok(close($out), "Close stdout"); +ok(close($err), "Close stderr"); + +my $one = Test::Stream::IOSets->new; +isa_ok($one, 'Test::Stream::IOSets'); +mostly_like( + $one, + { ':legacy' => [], ':utf8' => undef }, + "Legacy encoding is set", +); + +ok($one->init_encoding('utf8'), "init utf8"); + +mostly_like( + $one, + { ':legacy' => [], ':utf8' => [] }, + "utf8 encoding is set", +); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Meta.t b/cpan/Test-Simple/t/Test-Stream-Meta.t new file mode 100644 index 0000000000..8417b13aff --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Meta.t @@ -0,0 +1,16 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::Meta'; + +my $meta = init_tester('Some::Package'); +ok($meta, "got meta"); +isa_ok($meta, 'Test::Stream::Meta'); +can_ok($meta, qw/package encoding modern todo stream/); + +is(is_tester('Some::Package'), $meta, "remember the meta"); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-PackageUtil.t b/cpan/Test-Simple/t/Test-Stream-PackageUtil.t new file mode 100644 index 0000000000..e55c0f9a4b --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-PackageUtil.t @@ -0,0 +1,38 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::PackageUtil'; + +can_ok(__PACKAGE__, qw/package_sym package_purge_sym/); + +my $ok = package_sym(__PACKAGE__, CODE => 'ok'); +is($ok, \&ok, "package sym gave us the code symbol"); + +my $todo = package_sym(__PACKAGE__, SCALAR => 'TODO'); +is($todo, \$TODO, "got the TODO scalar"); + +our $foo = 'foo'; +our @foo = ('f', 'o', 'o'); +our %foo = (f => 'oo'); +sub foo { 'foo' }; + +is(foo(), 'foo', "foo() is defined"); +is($foo, 'foo', '$foo is defined'); +is_deeply(\@foo, [ 'f', 'o', 'o' ], '@foo is defined'); +is_deeply(\%foo, { f => 'oo' }, '%foo is defined'); + +package_purge_sym(__PACKAGE__, CODE => 'foo'); + +is($foo, 'foo', '$foo is still defined'); +is_deeply(\@foo, [ 'f', 'o', 'o' ], '@foo is still defined'); +is_deeply(\%foo, { f => 'oo' }, '%foo is still defined'); +my $r = eval { foo() }; +my $e = $@; +ok(!$r, "Failed to call foo()"); +like($e, qr/Undefined subroutine &main::foo called/, "foo() is not defined anymore"); +ok(!__PACKAGE__->can('foo'), "can() no longer thinks we can do foo()"); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Tester-Grab.t b/cpan/Test-Simple/t/Test-Stream-Tester-Grab.t new file mode 100644 index 0000000000..505980790a --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Tester-Grab.t @@ -0,0 +1,11 @@ +use strict; +use warnings; + +use Test::More; + +use ok 'Test::Stream::Tester::Grab'; + +# The tests for this can be found in t/Test-Tester2.t which is the only context +# that makes sense. + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Tester.t b/cpan/Test-Simple/t/Test-Stream-Tester.t new file mode 100644 index 0000000000..7eac4005a5 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Tester.t @@ -0,0 +1,140 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::Tester'; + +can_ok( __PACKAGE__, 'intercept', 'events_are' ); + +my $events = intercept { + ok(1, "Woo!"); + ok(0, "Boo!"); +}; + +isa_ok($events->[0], 'Test::Stream::Event::Ok'); +is($events->[0]->bool, 1, "Got one success"); +is($events->[0]->name, "Woo!", "Got test name"); + +isa_ok($events->[1], 'Test::Stream::Event::Ok'); +is($events->[1]->bool, 0, "Got one fail"); +is($events->[1]->name, "Boo!", "Got test name"); + +$events = undef; +my $grab = grab(); +my $got = $grab ? 1 : 0; +ok(1, "Intercepted!"); +ok(0, "Also Intercepted!"); +$events = $grab->finish; +ok($got, "Delayed test that we did in fact get a grab object"); +is($grab, undef, "Poof! vanished!"); +is(@$events, 2, "got 2 events (2 ok)"); +events_are( + $events, + check { + event ok => { bool => 1 }; + event ok => { + bool => 0, + diag => qr/Failed/, + }; + dir 'end'; + }, + 'intercepted via grab 1' +); + +$events = undef; +$grab = grab(); +ok(1, "Intercepted!"); +ok(0, "Also Intercepted!"); +events_are( + $grab, + check { + event ok => { bool => 1 }; + event ok => { bool => 0, diag => qr/Failed/ }; + dir 'end'; + }, + 'intercepted via grab 2' +); +ok(!$grab, "Maybe it never existed?"); + +$events = intercept { + ok(1, "Woo!"); + BAIL_OUT("Ooops"); + ok(0, "Should not see this"); +}; +is(@$events, 2, "Only got 2"); +isa_ok($events->[0], 'Test::Stream::Event::Ok'); +isa_ok($events->[1], 'Test::Stream::Event::Bail'); + +$events = intercept { + plan skip_all => 'All tests are skipped'; + + ok(1, "Woo!"); + BAIL_OUT("Ooops"); + ok(0, "Should not see this"); +}; +is(@$events, 1, "Only got 1"); +isa_ok($events->[0], 'Test::Stream::Event::Plan'); + +my $file = __FILE__; +my $line1; +my $line2; +events_are( + intercept { + events_are( + intercept { ok(1, "foo"); $line1 = __LINE__ }, + check { + $line2 = __LINE__ + 1; + event ok => {bool => 0}; + dir 'end'; + }, + 'Lets name this test!', + ); + }, + + check { + event ok => { + bool => 0, + diag => [ + qr{Failed test 'Lets name this test!'.*at (\./)?$0 line}s, + qr{ Event: 'ok' from \Q$0\E line $line1}s, + qr{ Check: 'ok' from \Q$0\E line $line2}s, + qr{ \$got->\{bool\} = '1'}, + qr{ \$exp->\{bool\} = '0'}, + ], + }; + + dir 'end'; + }, + 'Failure diag checking', +); + +my $line3; +events_are( + intercept { + events_are( + intercept { ok(1, "foo"); ok(1, "bar"); $line3 = __LINE__ }, + check { + event ok => {bool => 1}; + dir 'end' + }, + "Should Fail" + ); + }, + + check { + event ok => { + bool => 0, + diag => [ + qr/Failed test 'Should Fail'/, + qr/Expected end of events, got 'ok' from \Q$0\E line $line3/, + ], + }; + }, + + end => 'skipping a diag', +); + + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Toolset.t b/cpan/Test-Simple/t/Test-Stream-Toolset.t new file mode 100644 index 0000000000..432af90984 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Toolset.t @@ -0,0 +1,11 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'Test::Stream::Toolset'; + +can_ok(__PACKAGE__, qw/is_tester init_tester context/); + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Stream-Util.t b/cpan/Test-Simple/t/Test-Stream-Util.t new file mode 100644 index 0000000000..fa9ff54aec --- /dev/null +++ b/cpan/Test-Simple/t/Test-Stream-Util.t @@ -0,0 +1,45 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; +use Scalar::Util qw/dualvar/; + +use ok 'Test::Stream::Util', qw{ + try protect spoof is_regex is_dualvar +}; + +can_ok(__PACKAGE__, qw{ + try protect spoof is_regex is_dualvar +}); + +my $x = dualvar( 100, 'one-hundred' ); +ok(is_dualvar($x), "Got dual var"); +$x = 1; +ok(!is_dualvar($x), "Not dual var"); + +$! = 100; + +my $ok = eval { protect { die "xxx" }; 1 }; +ok(!$ok, "protect did not capture exception"); +like($@, qr/xxx/, "expected exception"); + +cmp_ok($!, '==', 100, "\$! did not change"); +$@ = 'foo'; + +($ok, my $err) = try { die "xxx" }; +ok(!$ok, "cought exception"); +like( $err, qr/xxx/, "expected exception"); +is($@, 'foo', '$@ is saved'); +cmp_ok($!, '==', 100, "\$! did not change"); + +ok(is_regex(qr/foo bar baz/), 'qr regex'); +ok(is_regex('/xxx/'), 'slash regex'); +ok(!is_regex('xxx'), 'not a regex'); + +my ($ret, $e) = spoof ["The::Moon", "Moon.pm", 11] => "die 'xxx' . __PACKAGE__"; +ok(!$ret, "Failed eval"); +like( $e, qr/^xxxThe::Moon at Moon\.pm line 11\.?/, "Used correct package, file, and line"); + + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Tester-Capture.t b/cpan/Test-Simple/t/Test-Tester-Capture.t new file mode 100644 index 0000000000..c4a61bae37 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Tester-Capture.t @@ -0,0 +1,9 @@ +use strict; +use warnings; + +use Test::More; +use ok 'Test::Tester::Capture'; + +# This is tested in t/Legacy/TestTester + +done_testing; diff --git a/cpan/Test-Simple/t/Test-Tester.t b/cpan/Test-Simple/t/Test-Tester.t new file mode 100644 index 0000000000..260b228531 --- /dev/null +++ b/cpan/Test-Simple/t/Test-Tester.t @@ -0,0 +1,9 @@ +use strict; +use warnings; + +use Test::More; +use ok 'Test::Tester'; + +# The tests for this can be found in t/Legacy/TestTester + +done_testing; diff --git a/cpan/Test-Simple/t/Test-use-ok.t b/cpan/Test-Simple/t/Test-use-ok.t new file mode 100644 index 0000000000..b84b4a15fd --- /dev/null +++ b/cpan/Test-Simple/t/Test-use-ok.t @@ -0,0 +1,25 @@ +use strict; +use warnings; + +use Test::Stream; +use Test::More; + +use ok 'ok'; + +use Test::Stream::Tester; + +events_are ( + intercept { + eval "use ok 'Something::Fake'; 1" || die $@; + }, + check { + event ok => { + bool => 0, + name => 'use Something::Fake;', + diag => qr/^\s*Failed test 'use Something::Fake;'/, + }; + }, + "Basic test" +); + +done_testing; diff --git a/cpan/Test-Simple/t/lib/MyTest.pm b/cpan/Test-Simple/t/lib/MyTest.pm new file mode 100644 index 0000000000..e8ad8a3e53 --- /dev/null +++ b/cpan/Test-Simple/t/lib/MyTest.pm @@ -0,0 +1,15 @@ +use strict; +use warnings; + +package MyTest; + +use Test::Builder; + +my $Test = Test::Builder->new; + +sub ok +{ + $Test->ok(@_); +} + +1; diff --git a/cpan/Test-Simple/t/lib/SmallTest.pm b/cpan/Test-Simple/t/lib/SmallTest.pm new file mode 100644 index 0000000000..c2a875855e --- /dev/null +++ b/cpan/Test-Simple/t/lib/SmallTest.pm @@ -0,0 +1,35 @@ +use strict; +use warnings; + +package SmallTest; + +require Exporter; + +use vars qw( @ISA @EXPORT ); +@ISA = qw( Exporter ); +@EXPORT = qw( ok is_eq is_num ); + +use Test::Builder; + +my $Test = Test::Builder->new; + +sub ok +{ + $Test->ok(@_); +} + +sub is_eq +{ + $Test->is_eq(@_); +} + +sub is_num +{ + $Test->is_num(@_); +} + +sub getTest +{ + return $Test; +} +1; diff --git a/cpan/Test-Simple/t/threads.t b/cpan/Test-Simple/t/threads.t deleted file mode 100644 index 42ba8c269c..0000000000 --- a/cpan/Test-Simple/t/threads.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/perl -w - -BEGIN { - if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; - } -} - -use Config; -BEGIN { - unless ( $] >= 5.008001 && $Config{'useithreads'} && - eval { require threads; 'threads'->import; 1; }) - { - print "1..0 # Skip: no working threads\n"; - exit 0; - } -} - -use strict; -use Test::Builder; - -my $Test = Test::Builder->new; -$Test->exported_to('main'); -$Test->plan(tests => 6); - -for(1..5) { - 'threads'->create(sub { - $Test->ok(1,"Each of these should app the test number") - })->join; -} - -$Test->is_num($Test->current_test(), 5,"Should be five"); diff --git a/cpan/Test-Simple/t/versions.t b/cpan/Test-Simple/t/versions.t deleted file mode 100644 index cb83599364..0000000000 --- a/cpan/Test-Simple/t/versions.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -w - -# Make sure all the modules have the same version -# -# TBT has its own version system. - -use strict; -use Test::More; - -require Test::Builder; -require Test::Builder::Module; -require Test::Simple; - -my $dist_version = Test::More->VERSION; - -like( $dist_version, qr/^ \d+ \. \d+ $/x ); - -my @modules = qw( - Test::Simple - Test::Builder - Test::Builder::Module -); - -for my $module (@modules) { - is( $dist_version, $module->VERSION, $module ); -} - -done_testing(4); |