From 975b9d397076e26ba205a71cac4a5db190d873f9 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 18 Mar 2018 18:25:38 +0100 Subject: t/: Move `$BIN` variable to module In order to be able to easily reuse the `$BIN` variable we created in the test for the `clear` sub-command, move it to a Perl module that can be included in other tests. Add the `t/` directory to the include path when running `prove` to ensure that `bin.pm` can be found and included. Thanks to these resources for explaining Perl modules: https://perlmaven.com/how-to-create-a-perl-module-for-code-reuse https://stackoverflow.com/questions/23899121/perl-declare-and-export-variables-from-a-module/23900384#23900384 https://stackoverflow.com/questions/17931981/what-is-isa-in-perl/17932340#17932340 --- t/100-clear-clears-all-branches-from-list.t | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 't/100-clear-clears-all-branches-from-list.t') 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 $!; -- cgit v1.2.3