diff options
Diffstat (limited to 't')
-rw-r--r-- | t/001-setup.t | 21 | ||||
-rw-r--r-- | t/100-clear-clears-all-branches-from-list.t | 36 | ||||
-rw-r--r-- | t/999-teardown.t | 14 |
3 files changed, 71 insertions, 0 deletions
diff --git a/t/001-setup.t b/t/001-setup.t new file mode 100644 index 0000000..0e591c4 --- /dev/null +++ b/t/001-setup.t @@ -0,0 +1,21 @@ +#!/usr/bin/env perl -w + +use strict; + +use Test::More; + +system('git init t-git-repo'); +ok !$?; + +chdir 't-git-repo' or die $!; + +system('echo tmp > tmp.txt'); +ok !$?; + +system('git add tmp.txt'); +ok !$?; + +system('git commit -m "Commit"'); +ok !$?; + +done_testing; diff --git a/t/100-clear-clears-all-branches-from-list.t b/t/100-clear-clears-all-branches-from-list.t new file mode 100644 index 0000000..952d68a --- /dev/null +++ b/t/100-clear-clears-all-branches-from-list.t @@ -0,0 +1,36 @@ +#!/usr/bin/env perl -w + +use strict; + +use Test::More; + +use File::Spec; + +my $BIN = File::Spec->rel2abs('git-branch-list'); + +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("$BIN clear"); +ok !$?; + +my $branch_list = qx($BIN); +is $branch_list, ''; + + +# Teardown +system('git branch -d first second'); + + +done_testing; diff --git a/t/999-teardown.t b/t/999-teardown.t new file mode 100644 index 0000000..e7e8ab2 --- /dev/null +++ b/t/999-teardown.t @@ -0,0 +1,14 @@ +#!/usr/bin/env perl -w + +use strict; + +use Test::More; + +if (!-d 't-git-repo') { + plan skip_all => 'Testing stage already cleaned.'; +} + +system('rm -rf t-git-repo'); +ok !$?; + +done_testing; |