aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/100-clear-clears-all-branches-from-list.t4
-rw-r--r--t/101-drop-accepts-multiple-branch-arguments.t42
-rw-r--r--t/102-drop-drops-current-branch.t29
-rw-r--r--t/bin.pm13
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;