diff options
author | Teddy Wing | 2018-03-21 18:13:00 +0100 |
---|---|---|
committer | Teddy Wing | 2018-03-21 18:13:00 +0100 |
commit | 25991886eba08a3baa418d7b5f4e5e4eaa5df23b (patch) | |
tree | 3ebd3ecfce83ce5da79e6c442b16c0becfada4fd /t | |
parent | 9a4abcc9b0e1121c89ae8a12be8eeb291e7dd34e (diff) | |
parent | 64fe9fc7fa4e073d6bb97cdee0d2914abb943391 (diff) | |
download | git-branch-list-25991886eba08a3baa418d7b5f4e5e4eaa5df23b.tar.bz2 |
Merge branch 'drop-multiple-branches'
Diffstat (limited to 't')
-rw-r--r-- | t/100-clear-clears-all-branches-from-list.t | 4 | ||||
-rw-r--r-- | t/101-drop-accepts-multiple-branch-arguments.t | 42 | ||||
-rw-r--r-- | t/102-drop-drops-current-branch.t | 29 | ||||
-rw-r--r-- | t/bin.pm | 13 |
4 files changed, 85 insertions, 3 deletions
diff --git a/t/100-clear-clears-all-branches-from-list.t b/t/100-clear-clears-all-branches-from-list.t index 952d68a..2e53350 100644 --- a/t/100-clear-clears-all-branches-from-list.t +++ b/t/100-clear-clears-all-branches-from-list.t @@ -4,9 +4,7 @@ use strict; use Test::More; -use File::Spec; - -my $BIN = File::Spec->rel2abs('git-branch-list'); +use Bin qw($BIN); chdir 't-git-repo' or die $!; diff --git a/t/101-drop-accepts-multiple-branch-arguments.t b/t/101-drop-accepts-multiple-branch-arguments.t new file mode 100644 index 0000000..16767bf --- /dev/null +++ b/t/101-drop-accepts-multiple-branch-arguments.t @@ -0,0 +1,42 @@ +#!/usr/bin/env perl -w + +use strict; + +use Test::More; + +use Bin qw($BIN); + +chdir 't-git-repo' or die $!; + +system('git branch first'); +ok !$?; + +system("$BIN save first"); +ok !$?; + +system('git branch second'); +ok !$?; + +system("$BIN save second"); +ok !$?; + +system('git branch third'); +ok !$?; + +system("$BIN save third"); +ok !$?; + +system("$BIN drop 1 3"); +ok !$?; + +my $branch_list = qx($BIN); +is $branch_list, ' 1 second +'; + + +# Teardown +system('git branch -d first second third'); +system("$BIN clear"); + + +done_testing; diff --git a/t/102-drop-drops-current-branch.t b/t/102-drop-drops-current-branch.t new file mode 100644 index 0000000..5534b6e --- /dev/null +++ b/t/102-drop-drops-current-branch.t @@ -0,0 +1,29 @@ +#!/usr/bin/env perl -w + +use strict; + +use Test::More; + +use Bin qw($BIN); + +chdir 't-git-repo' or die $!; + +system('git checkout -b first'); +ok !$?; + +system("$BIN save"); +ok !$?; + +system("$BIN drop"); +ok !$?; + +my $branch_list = qx($BIN); +is $branch_list, ''; + + +# Teardown +system('git checkout master'); +system('git branch -d first'); + + +done_testing; diff --git a/t/bin.pm b/t/bin.pm new file mode 100644 index 0000000..ad5b7f1 --- /dev/null +++ b/t/bin.pm @@ -0,0 +1,13 @@ +package Bin; + +use strict; +use warnings; + +use Exporter qw(import); +our @EXPORT = qw($BIN); + +use File::Spec; + +our $BIN = File::Spec->rel2abs('git-branch-list'); + +1; |