From f6bb0d359c7c46eb41a3d760a85f2cc2aad3a79d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 23 Sep 2015 22:04:35 -0400 Subject: Test setup * Add Makefile with test target/goal copied from Richard Hartmann's vcsh. Now that I think about it, I really need to change that because vcsh is GPL. Will do that soon. * Add setup and teardown test files that create a remove a directory. This directory will be a basic git repo where we'll install our git hook and then test output from different commits in the repo. --- Makefile | 5 +++++ t/001-setup.t | 13 +++++++++++++ t/999-teardown.t | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 Makefile create mode 100644 t/001-setup.t create mode 100644 t/999-teardown.t diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4f0579c --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +# Copied from Richard Hartmann's vcsh: +# https://github.com/RichiH/vcsh/blob/master/Makefile +test: + @if which git > /dev/null; then : ; else echo "'git' not found, exiting..." ; exit 1; fi + @if which prove > /dev/null; then prove; else echo "'prove' not found; not running tests"; fi diff --git a/t/001-setup.t b/t/001-setup.t new file mode 100644 index 0000000..0789bd7 --- /dev/null +++ b/t/001-setup.t @@ -0,0 +1,13 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Test::More; + +system('mkdir -p t/git-repo'); +ok !$?; + +chdir 't/git-repo' or die $!; + +done_testing; diff --git a/t/999-teardown.t b/t/999-teardown.t new file mode 100644 index 0000000..ff39a99 --- /dev/null +++ b/t/999-teardown.t @@ -0,0 +1,17 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Test::More; + +chdir 't' or die $!; + +if (!-d 'git-repo') { + plan skip_all => 'Testing stage already cleaned.'; +} + +system('rm -rf git-repo'); +ok !$?; + +done_testing; -- cgit v1.2.3