Skip to content

Commit

Permalink
add helper for focusing on a particular subtest
Browse files Browse the repository at this point in the history
and call the function in each subtest
  • Loading branch information
justone committed Apr 21, 2012
1 parent 781a25a commit 9a955ca
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions t/01.simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ check_minimum_test_more_version();
my $profile_filename = ( lc($OSNAME) eq 'darwin' ) ? '.profile' : '.bashrc';

subtest 'simplest' => sub {
focus('simplest');

my ( $home, $repo, $origin );
( $home, $repo, $origin ) = minimum_home('simple');
( $home, $repo ) = minimum_home( 'simple2', { origin => $origin } );
Expand All @@ -38,6 +40,8 @@ SKIP: {
};

subtest 'dangling symlinks' => sub {
focus('dangling');

my ( $home, $repo ) = minimum_home_with_ssh('dangling');

symlink( ".dotfiles/.other", "$home/.other" );
Expand All @@ -50,6 +54,7 @@ subtest 'dangling symlinks' => sub {
};

subtest 'with . ssh recurse( no . ssh dir )' => sub {
focus('recurse_no');

my ( $home, $repo ) = minimum_home_with_ssh( 'ssh_no', 1 );
my $output = `HOME=$home perl $repo/bin/dfm --verbose`;
Expand All @@ -58,6 +63,7 @@ subtest 'with . ssh recurse( no . ssh dir )' => sub {
};

subtest 'with .ssh recurse (with .ssh dir)' => sub {
focus('recurse_with');

my ( $home, $repo ) = minimum_home_with_ssh('ssh_with');
my $output = `HOME=$home perl $repo/bin/dfm --verbose`;
Expand All @@ -66,6 +72,8 @@ subtest 'with .ssh recurse (with .ssh dir)' => sub {
};

subtest 'with bin recurse' => sub {
focus('bin_recurse');

my ( $home, $repo, $origin );
( $home, $repo, $origin )
= minimum_home( 'bin_recurse', { dfminstall_contents => 'bin' } );
Expand All @@ -83,6 +91,8 @@ subtest 'with bin recurse' => sub {
};

subtest 'check deprecated recursion' => sub {
focus('deprec');

my ( $home, $repo );

( $home, $repo )
Expand Down Expand Up @@ -116,6 +126,8 @@ subtest 'check deprecated recursion' => sub {
};

subtest 'switch to recursion' => sub {
focus('rec_switch');

my ( $home, $repo, $origin );
( $home, $repo, $origin ) = minimum_home('switch_recurse');

Expand All @@ -136,6 +148,8 @@ subtest 'switch to recursion' => sub {
};

subtest 'parallel recursions work' => sub {
focus('parallel_rec');

my ( $home, $repo, $origin );
( $home, $repo, $origin )
= minimum_home( 'parallel_recursions',
Expand Down
14 changes: 14 additions & 0 deletions t/02.updates_mergeandinstall.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ check_minimum_test_more_version();
my $profile_filename = ( lc($OSNAME) eq 'darwin' ) ? '.profile' : '.bashrc';

subtest 'updates and mergeandinstall' => sub {
focus('up_mi');

my ( $home, $repo, $origin ) = minimum_home('host1');
my ( $home2, $repo2 ) = minimum_home( 'host2', { origin => $origin } );

Expand Down Expand Up @@ -41,6 +43,8 @@ subtest 'updates and mergeandinstall' => sub {
};

subtest 'modifications in two repos, rebase' => sub {
focus('rebase');

my ( $home, $repo, $origin ) = minimum_home('host1_rebase');
my ( $home2, $repo2 )
= minimum_home( 'host2_rebase', { origin => $origin } );
Expand Down Expand Up @@ -77,6 +81,8 @@ subtest 'modifications in two repos, rebase' => sub {
};

subtest 'modifications in two repos, merge' => sub {
focus('merge');

my ( $home, $repo, $origin ) = minimum_home('host1_merge');
my ( $home2, $repo2 )
= minimum_home( 'host2_merge', { origin => $origin } );
Expand Down Expand Up @@ -110,6 +116,8 @@ subtest 'modifications in two repos, merge' => sub {
};

subtest 'umi' => sub {
focus('umi');

my ( $home, $repo, $origin ) = minimum_home('host1');
my ( $home2, $repo2 ) = minimum_home( 'host2', { origin => $origin } );

Expand All @@ -125,6 +133,8 @@ subtest 'umi' => sub {
};

subtest 'non origin remote' => sub {
focus('non_origin');

my ( $home, $repo, $origin ) = minimum_home('host1');
my ( $home2, $repo2, $origin2 ) = minimum_home('host2');

Expand All @@ -151,6 +161,8 @@ subtest 'non origin remote' => sub {
};

subtest 'non origin remote different name' => sub {
focus('non_origin_diff_name');

my ( $home, $repo, $origin ) = minimum_home('host1');
my ( $home2, $repo2, $origin2 ) = minimum_home('host2');

Expand Down Expand Up @@ -178,6 +190,8 @@ subtest 'non origin remote different name' => sub {
};

subtest 'check remote branch' => sub {
focus('check_remote');

my ( $home, $repo, $origin ) = minimum_home('host1');

# first, make a personal branch in repo 1, and add a new file
Expand Down
4 changes: 4 additions & 0 deletions t/03.uninstall.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ check_minimum_test_more_version();
my $profile_filename = ( lc($OSNAME) eq 'darwin' ) ? '.profile' : '.bashrc';

subtest 'uninstall dotfiles' => sub {
focus('uninstall');

my ( $home, $repo ) = minimum_home_with_ssh('uninstall');
extra_setup($home);

Expand Down Expand Up @@ -44,6 +46,8 @@ SKIP: {
};

subtest 'uninstall dotfiles (dry-run)' => sub {
focus('uninstall_dry');

my ( $home, $repo ) = minimum_home_with_ssh('uninstall');
extra_setup($home);

Expand Down
4 changes: 4 additions & 0 deletions t/04.misc.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ my $version = '0.5';
check_minimum_test_more_version();

subtest 'help works on all subcommands' => sub {
focus('help');

my ( $home, $repo ) = minimum_home('help');

foreach my $command (qw(install mergeandinstall updates)) {
Expand All @@ -25,6 +27,8 @@ subtest 'help works on all subcommands' => sub {
};

subtest 'version commandline flag' => sub {
focus('version');

my ( $home, $repo ) = minimum_home('version');

my $output = `HOME=$home perl $repo/bin/dfm --version`;
Expand Down
7 changes: 7 additions & 0 deletions t/helper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,11 @@ sub check_minimum_test_more_version {
plan skip_all => 'Test::More version 0.98 required';
}
}

sub focus {
my $name = shift;
if ( defined $ENV{DFM_TEST} && $ENV{DFM_TEST} ne $name ) {
plan skip_all => "focus on tests ($name)";
}
}
1;

0 comments on commit 9a955ca

Please sign in to comment.