From 0f46312aad2e8267574aceb8dfbb14b92248f2dc Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 14 Sep 2020 02:00:36 +0200 Subject: t/: Add test to get a TODO since the fork point In order to include the 'bin.pm' file, we need to add its containing folder to the include path. Do this by adding a Makefile with the required command line argument. Add a new test that modifies the test file to add a new new TODO line. Test that it comes back in the `git todo` output. --- Makefile | 4 +++ t/100-shows-todo-comments-since-fork-point.t | 48 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Makefile create mode 100644 t/100-shows-todo-comments-since-fork-point.t diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e67850b --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: test + +test: + prove -v -I./t diff --git a/t/100-shows-todo-comments-since-fork-point.t b/t/100-shows-todo-comments-since-fork-point.t new file mode 100644 index 0000000..bb35c9d --- /dev/null +++ b/t/100-shows-todo-comments-since-fork-point.t @@ -0,0 +1,48 @@ +#!/usr/bin/env perl -w + +use strict; + +use File::Copy; +use Test::More; + +use Bin qw($BIN); + +my $file = 'git-sugdiff.rs'; + +chdir 't-git-repo' or die $!; + +system('git checkout -b fork-point'); +ok !$?; + +open(my $input, '<', $file) or die $!; +open(my $output, '>', "$file.out") or die $!; + +while (<$input>) { + if ($. == 34) { + print $output " // TODO: 100-shows-todo-comments-since-fork-point\n"; + } + + print $output $_; +} + +close $input; +close $output; + +move("$file.out", $file) or die $!; + +system('git add git-sugdiff.rs'); +ok !$?; + +system('git commit -m "New TODO"'); +ok !$?; + +my $todos = qx($BIN); +is $todos, 'TODO: 100-shows-todo-comments-since-fork-point +'; + + +# Teardown +system('git branch -d fork-point'); + + +done_testing; -- cgit v1.2.3