Merge branch 'hooks' into 1.9.0

Conflicts:
	src/command.cpp
	src/report.cpp
This commit is contained in:
Paul Beckingham
2010-01-27 22:46:20 -05:00
17 changed files with 1592 additions and 409 deletions

View File

@@ -1,15 +1,16 @@
PROJECT = t.t tdb.t date.t duration.t t.benchmark.t text.t autocomplete.t \
config.t seq.t att.t stringtable.t record.t nibbler.t subst.t filt.t \
cmd.t util.t color.t list.t path.t file.t directory.t
CFLAGS = -I. -I.. -Wall -pedantic -ggdb3 -fno-rtti
CFLAGS = -I. -I.. -I../.. -Wall -pedantic -ggdb3 -fno-rtti
LFLAGS = -L/usr/local/lib -lncurses
OBJECTS = ../TDB.o ../Task.o ../text.o ../Date.o ../Table.o ../Duration.o \
../util.o ../Config.o ../Sequence.o ../Att.o ../Cmd.o ../Record.o \
../StringTable.o ../Subst.o ../Nibbler.o ../Location.o ../Filter.o \
../Context.o ../Keymap.o ../command.o ../interactive.o ../report.o \
../Grid.o ../Color.o ../rules.o ../recur.o ../custom.o ../import.o \
../edit.o ../Timer.o ../Permission.o ../Path.o ../File.o \
../Directory.o
OBJECTS = ../t-TDB.o ../t-Task.o ../t-text.o ../t-Date.o ../t-Table.o \
../t-Duration.o ../t-util.o ../t-Config.o ../t-Sequence.o ../t-Att.o \
../t-Cmd.o ../t-Record.o ../t-StringTable.o ../t-Subst.o \
../t-Nibbler.o ../t-Location.o ../t-Filter.o ../t-Context.o \
../t-Keymap.o ../t-command.o ../t-interactive.o ../t-report.o \
../t-Grid.o ../t-Color.o ../t-rules.o ../t-recur.o ../t-custom.o \
../t-import.o ../t-edit.o ../t-Timer.o ../t-Permission.o ../t-Path.o \
../t-File.o ../t-Directory.o ../t-Hooks.o ../t-API.o
all: $(PROJECT)

67
src/tests/hook.post-start.t Executable file
View File

@@ -0,0 +1,67 @@
#! /usr/bin/perl
################################################################################
## task - a command line task list manager.
##
## Copyright 2006 - 2010, Paul Beckingham.
## All rights reserved.
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the
##
## Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor,
## Boston, MA
## 02110-1301
## USA
##
################################################################################
use strict;
use warnings;
use Test::More tests => 7;
# Create the rc file.
if (open my $fh, '>', 'hook.rc')
{
print $fh "data.location=.\n",
"hook.post-start=" . $ENV{'PWD'} . "/hook:test\n";
close $fh;
ok (-r 'hook.rc', 'Created hook.rc');
}
if (open my $fh, '>', 'hook')
{
print $fh "function test () print ('marker') return 0, nil end\n";
close $fh;
ok (-r 'hook', 'Created hook');
}
# Test the hook.
my $output = qx{../task rc:hook.rc _version};
like ($output, qr/^marker.+\n\d\.\d+\.\d+\n$/ms, 'Found marker before output');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'hook';
ok (!-r 'hook', 'Removed hook');
unlink 'hook.rc';
ok (!-r 'hook.rc', 'Removed hook.rc');
exit 0;

67
src/tests/hook.pre-exit.t Executable file
View File

@@ -0,0 +1,67 @@
#! /usr/bin/perl
################################################################################
## task - a command line task list manager.
##
## Copyright 2006 - 2010, Paul Beckingham.
## All rights reserved.
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the
##
## Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor,
## Boston, MA
## 02110-1301
## USA
##
################################################################################
use strict;
use warnings;
use Test::More tests => 7;
# Create the rc file.
if (open my $fh, '>', 'hook.rc')
{
print $fh "data.location=.\n",
"hook.pre-exit=" . $ENV{'PWD'} . "/hook:test\n";
close $fh;
ok (-r 'hook.rc', 'Created hook.rc');
}
if (open my $fh, '>', 'hook')
{
print $fh "function test () print ('marker') return 0, nil end\n";
close $fh;
ok (-r 'hook', 'Created hook');
}
# Test the hook.
my $output = qx{../task rc:hook.rc _version};
like ($output, qr/\n\d\.\d+\.\d+\nmarker\n$/ms, 'Found marker after output');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'hook';
ok (!-r 'hook', 'Removed hook');
unlink 'hook.rc';
ok (!-r 'hook.rc', 'Removed hook.rc');
exit 0;