Guest User

Untitled

a guest
Apr 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.74 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use warnings;
  3. use strict;
  4. use Test::More;
  5. use Test::Exception;
  6. subtest 'Testing dies_ok inside a subtest' => sub {
  7.     dies_ok {
  8.         subtest 'Subtest inside dies_ok' => sub {
  9.             die;
  10.         };
  11.     } 'Die inside subtest';
  12. };
  13. done_testing();
  14. 1;
  15.  
  16. __END__
  17.  
  18. =head1
  19.  
  20. Test::More 0.96
  21. Test::Builder 0.98
  22. Test::Exception 0.31
  23.  
  24. Output from running the above:    
  25.  
  26.     # Child (Subtest inside dies_ok) exited without calling finalize()
  27.     not ok 1 - Subtest inside dies_ok
  28.     #   Failed test 'Subtest inside dies_ok'
  29.     #   at /.../Test/Builder.pm line 252.
  30.     ok 2 - Die inside subtest
  31.     1..2
  32. Can't call finalize() with child (Subtest inside dies_ok) active at /.../Test/More.pm line 747.
  33.  
  34. =cut
Add Comment
Please, Sign In to add comment