Skip to content

Instantly share code, notes, and snippets.

@gfx
Created April 30, 2013 06:46
Show Gist options
  • Save gfx/5487003 to your computer and use it in GitHub Desktop.
Save gfx/5487003 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More;
BEGIN {
use List::Util ();
no warnings 'redefine';
my $orig_subtest = \&subtest;
my @tests;
*subtest = sub {
my($name, $block) = @_;
push @tests, [$name, $block];
};
my $orig_done_testing = \&done_testing;
*done_testing = sub {
for my $pair(List::Util::shuffle(@tests)) {
$orig_subtest->(@$pair);
}
$orig_done_testing->();
};
}
subtest 'foo', sub {
pass "in foo";
};
subtest 'bar', sub {
pass "in bar";
};
subtest 'baz', sub {
pass "in baz";
};
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment