diff options
author | Teddy Wing | 2020-09-14 02:00:36 +0200 |
---|---|---|
committer | Teddy Wing | 2020-09-14 02:03:31 +0200 |
commit | 0f46312aad2e8267574aceb8dfbb14b92248f2dc (patch) | |
tree | 6c40fa256cf87a88bbcfd530366310f32d30913f | |
parent | ae4ebe19b66e856758cbd3a9ed768ae146c004cd (diff) | |
download | git-todo-0f46312aad2e8267574aceb8dfbb14b92248f2dc.tar.bz2 |
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.
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | t/100-shows-todo-comments-since-fork-point.t | 48 |
2 files changed, 52 insertions, 0 deletions
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; |