aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-03-21 17:17:26 +0100
committerTeddy Wing2018-03-21 17:17:26 +0100
commit565c054f57248409eddc7ebe20629b85093f7c55 (patch)
tree771be1bd34c924ffff4c688f4457e1d8d7e2b0bf
parenta33c35b0561162306169fae17452a5b521ece067 (diff)
downloadgit-branch-list-565c054f57248409eddc7ebe20629b85093f7c55.tar.bz2
Add `drop` command tests
-rw-r--r--t/101-drop-accepts-multiple-branch-arguments.t43
-rw-r--r--t/102-drop-drops-current-branch.t29
2 files changed, 72 insertions, 0 deletions
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..b7834df
--- /dev/null
+++ b/t/101-drop-accepts-multiple-branch-arguments.t
@@ -0,0 +1,43 @@
+#!/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;