aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-03-18 16:05:30 +0100
committerTeddy Wing2018-03-18 16:05:30 +0100
commita47bf8ba13440c9691bf002a5bf687175d9c0937 (patch)
treeeefc872a810389c84def869a0e81d6a39cc5c189
parenta0d39b087ed767b52b6139275025df6f0a82b495 (diff)
downloadgit-branch-list-a47bf8ba13440c9691bf002a5bf687175d9c0937.tar.bz2
Add TAP test structure
Copied and modified from: https://github.com/teddywing/git-hook-pre-commit-python-javascript-syntax-linter/blob/efa1909/t/001-setup.t https://github.com/teddywing/git-hook-pre-commit-python-javascript-syntax-linter/blob/f6bb0d3/t/999-teardown.t
-rw-r--r--Makefile4
-rw-r--r--t/001-setup.t21
-rw-r--r--t/999-teardown.t14
3 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2cab678
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+.PHONY: test
+
+test:
+ prove -v
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/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;