From 0240ffa1d21bb39979a82bcd5edb514253079eb9 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 16 Apr 2011 15:19:07 -0400 Subject: [PATCH] Hooks - Removed obsolete hook unit tests. --- test/hook.api.task_debug.t | 81 ----------------------- test/hook.api.task_exit.t | 79 ---------------------- test/hook.api.task_feature.t | 89 ------------------------- test/hook.api.task_footnote.t | 80 ----------------------- test/hook.api.task_get_config.t | 80 ----------------------- test/hook.api.task_header.t | 80 ----------------------- test/hook.api.task_lua_version.t | 79 ---------------------- test/hook.api.task_os.t | 83 ----------------------- test/hook.api.task_version.t | 79 ---------------------- test/hook.format-age.t | 86 ------------------------ test/hook.format-age_compact.t | 87 ------------------------ test/hook.format-countdown.t | 84 ------------------------ test/hook.format-countdown_compact.t | 86 ------------------------ test/hook.format-depends.t | 85 ------------------------ test/hook.format-description.t | 84 ------------------------ test/hook.format-description_only.t | 86 ------------------------ test/hook.format-due.t | 84 ------------------------ test/hook.format-end.t | 85 ------------------------ test/hook.format-entry.t | 84 ------------------------ test/hook.format-id.t | 87 ------------------------ test/hook.format-priority-long.t | 98 ---------------------------- test/hook.format-priority.t | 96 --------------------------- test/hook.format-project.t | 84 ------------------------ test/hook.format-prompt.t | 84 ------------------------ test/hook.format-recur.t | 84 ------------------------ test/hook.format-start.t | 85 ------------------------ test/hook.format-tags.t | 84 ------------------------ test/hook.format-uuid.t | 84 ------------------------ test/hook.format-wait.t | 84 ------------------------ test/hook.pre-completed.t | 89 ------------------------- 30 files changed, 2540 deletions(-) delete mode 100755 test/hook.api.task_debug.t delete mode 100755 test/hook.api.task_exit.t delete mode 100755 test/hook.api.task_feature.t delete mode 100755 test/hook.api.task_footnote.t delete mode 100755 test/hook.api.task_get_config.t delete mode 100755 test/hook.api.task_header.t delete mode 100755 test/hook.api.task_lua_version.t delete mode 100755 test/hook.api.task_os.t delete mode 100755 test/hook.api.task_version.t delete mode 100755 test/hook.format-age.t delete mode 100755 test/hook.format-age_compact.t delete mode 100755 test/hook.format-countdown.t delete mode 100755 test/hook.format-countdown_compact.t delete mode 100755 test/hook.format-depends.t delete mode 100755 test/hook.format-description.t delete mode 100755 test/hook.format-description_only.t delete mode 100755 test/hook.format-due.t delete mode 100755 test/hook.format-end.t delete mode 100755 test/hook.format-entry.t delete mode 100755 test/hook.format-id.t delete mode 100755 test/hook.format-priority-long.t delete mode 100755 test/hook.format-priority.t delete mode 100755 test/hook.format-project.t delete mode 100755 test/hook.format-prompt.t delete mode 100755 test/hook.format-recur.t delete mode 100755 test/hook.format-start.t delete mode 100755 test/hook.format-tags.t delete mode 100755 test/hook.format-uuid.t delete mode 100755 test/hook.format-wait.t delete mode 100755 test/hook.pre-completed.t diff --git a/test/hook.api.task_debug.t b/test/hook.api.task_debug.t deleted file mode 100755 index 84aa0aae0..000000000 --- a/test/hook.api.task_debug.t +++ /dev/null @@ -1,81 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "debug=on\n", - "hook.pre-display=" . $ENV{'PWD'} . "/hook:test\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -if (open my $fh, '>', 'hook') -{ - print $fh "function test () task_debug_message ('DEBUG MESSAGE') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc info 1}; - like ($output, qr/DEBUG MESSAGE/ms, 'Hook called task_debug_message'); -} -else -{ - pass ('Hook called task_debug_message - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_exit.t b/test/hook.api.task_exit.t deleted file mode 100755 index fc5b2b9aa..000000000 --- a/test/hook.api.task_exit.t +++ /dev/null @@ -1,79 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\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 () task_exit () return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version}; - like ($output, qr/^Exiting.$/ms, 'Hook called task_exit'); -} -else -{ - pass ('Hook called task_exit - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_feature.t b/test/hook.api.task_feature.t deleted file mode 100755 index c5c2f00a2..000000000 --- a/test/hook.api.task_feature.t +++ /dev/null @@ -1,89 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 9; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\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 ()\n", - " if task_feature ('lua') then\n", - " print ('<>')\n", - " end\n", - " if task_feature ('foo') then\n", - " print ('<>')\n", - " end\n", - " return 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version}; - like ($output, qr/^<>$/ms, 'Hook called task_feature (lua)'); - unlike ($output, qr/^<>$/ms, 'Hook called task_feature (foo)'); -} -else -{ - pass ('Hook called task_feature (lua) - skip: no Lua support'); - pass ('Hook called task_feature (foo) - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_footnote.t b/test/hook.api.task_footnote.t deleted file mode 100755 index e6022b3dc..000000000 --- a/test/hook.api.task_footnote.t +++ /dev/null @@ -1,80 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.pre-display=" . $ENV{'PWD'} . "/hook:test\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -if (open my $fh, '>', 'hook') -{ - print $fh "function test () task_footnote_message ('FOOTNOTE MESSAGE') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc info 1}; - like ($output, qr/FOOTNOTE MESSAGE/ms, 'Hook called task_footnote_message'); -} -else -{ - pass ('Hook called task_footnote_message - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_get_config.t b/test/hook.api.task_get_config.t deleted file mode 100755 index cec0598fd..000000000 --- a/test/hook.api.task_get_config.t +++ /dev/null @@ -1,80 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "nag=NAG-STRING\n", - "hooks=on\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 (task_get_config ('nag')) return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version}; - like ($output, qr/^NAG-STRING$/ms, 'Hook called task_get_config'); -} -else -{ - pass ('Hook called task_get_config - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_header.t b/test/hook.api.task_header.t deleted file mode 100755 index 92f3942da..000000000 --- a/test/hook.api.task_header.t +++ /dev/null @@ -1,80 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.pre-display=" . $ENV{'PWD'} . "/hook:test\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -if (open my $fh, '>', 'hook') -{ - print $fh "function test () task_header_message ('HEADER MESSAGE') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc info 1}; - like ($output, qr/HEADER MESSAGE/ms, 'Hook called task_header_message'); -} -else -{ - pass ('Hook called task_header_message - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_lua_version.t b/test/hook.api.task_lua_version.t deleted file mode 100755 index 6c2e797b3..000000000 --- a/test/hook.api.task_lua_version.t +++ /dev/null @@ -1,79 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\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 ('<<' .. task_lua_version () .. '>>') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version}; - like ($output, qr/^<<\d\.\d+\.\d+.*>>$/ms, 'Hook called task_lua_version'); -} -else -{ - pass ('Hook called task_lua_version - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_os.t b/test/hook.api.task_os.t deleted file mode 100755 index 7cf90f076..000000000 --- a/test/hook.api.task_os.t +++ /dev/null @@ -1,83 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\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 ('<<' .. task_os () .. '>>') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version}; - - my ($os) = $output =~ /^<<(darwin|solaris|cygwin|openbsd|haiku|freebsd|linux)>>$/ms; - diag ($os); - - like ($os, qr/darwin|solaris|cygwin|openbsd|haiku|freebsd|linux/, 'Hook called task_os'); -} -else -{ - pass ('Hook called task_os - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.api.task_version.t b/test/hook.api.task_version.t deleted file mode 100755 index bf92b5362..000000000 --- a/test/hook.api.task_version.t +++ /dev/null @@ -1,79 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\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 ('<<' .. task_version () .. '>>') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version}; - like ($output, qr/^<<\d\.\d+\.\d+.*>>$/ms, 'Hook called task_version'); -} -else -{ - pass ('Hook called task_version - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-age.t b/test/hook.format-age.t deleted file mode 100755 index 36c8a9374..000000000 --- a/test/hook.format-age.t +++ /dev/null @@ -1,86 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-age=" . $ENV{'PWD'} . "/hook:age\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function age (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - diag ("1 second delay"); - sleep 1; - $output = qx{../src/task rc:hook.rc list}; - - like ($output, qr/<\d\ssecs?>/, 'format-age hook age -> '); -} -else -{ - pass ('format-age hook age -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-age_compact.t b/test/hook.format-age_compact.t deleted file mode 100755 index 1c235cc11..000000000 --- a/test/hook.format-age_compact.t +++ /dev/null @@ -1,87 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-age_compact=" . $ENV{'PWD'} . "/hook:age\n", - "report.list.columns=id,project,priority,due,active,age_compact,description\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function age (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - diag ("1 second delay"); - sleep 1; - $output = qx{../src/task rc:hook.rc list}; - - like ($output, qr/<\ds>/, 'format-age_compact hook age -> '); -} -else -{ - pass ('format-age_compact hook age -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-countdown.t b/test/hook.format-countdown.t deleted file mode 100755 index 7b75b2d73..000000000 --- a/test/hook.format-countdown.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-countdown=" . $ENV{'PWD'} . "/hook:countdown\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function countdown (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo due:eom}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr/<-?\d+\s\D+>/, 'format-countdown hook countdown -> '); -} -else -{ - pass ('format-countdown hook countdown -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-countdown_compact.t b/test/hook.format-countdown_compact.t deleted file mode 100755 index 4f4507aa8..000000000 --- a/test/hook.format-countdown_compact.t +++ /dev/null @@ -1,86 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "report.long.columns=id,project,priority,entry,start,due,", - "recur,countdown_compact,age,depends,tags,description\n", - "hooks=on\n", - "hook.format-countdown_compact=" . $ENV{'PWD'} . "/hook:countdown_compact\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function countdown_compact (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo due:eom}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr/<-?\d+\D+>/, 'format-countdown_compact hook countdown_compact -> '); -} -else -{ - pass ('format-countdown_compact hook countdown_compact -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-depends.t b/test/hook.format-depends.t deleted file mode 100755 index 999284c95..000000000 --- a/test/hook.format-depends.t +++ /dev/null @@ -1,85 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-depends=" . $ENV{'PWD'} . "/hook:depends\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function depends (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add one}; - qx{../src/task rc:hook.rc add two depends:1}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr/<1>/, 'format-depends hook 1 -> <1>'); -} -else -{ - pass ('format-depends hook 1 -> <1> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-description.t b/test/hook.format-description.t deleted file mode 100755 index cf8d3bfba..000000000 --- a/test/hook.format-description.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-description=" . $ENV{'PWD'} . "/hook:description\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function description (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc ls}; - - like ($output, qr//, 'format-description hook foo -> '); -} -else -{ - pass ('format-description hook foo -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-description_only.t b/test/hook.format-description_only.t deleted file mode 100755 index cf35e4c9a..000000000 --- a/test/hook.format-description_only.t +++ /dev/null @@ -1,86 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-description_only=" . $ENV{'PWD'} . "/hook:description_only\n", - "report.ls.columns=id,project,priority,description_only\n", - "report.ls.sort=priority-,project+\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function description_only (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc ls}; - - like ($output, qr//, 'format-description_only hook foo -> '); -} -else -{ - pass ('format-description_only hook foo -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-due.t b/test/hook.format-due.t deleted file mode 100755 index 4f946fe52..000000000 --- a/test/hook.format-due.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-due=" . $ENV{'PWD'} . "/hook:due\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function due (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo due:tomorrow}; - $output = qx{../src/task rc:hook.rc list}; - - like ($output, qr/<\d+\/\d+\/\d+>/, 'format-due hook due -> '); -} -else -{ - pass ('format-due hook due -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-end.t b/test/hook.format-end.t deleted file mode 100755 index 40728fa80..000000000 --- a/test/hook.format-end.t +++ /dev/null @@ -1,85 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-end=" . $ENV{'PWD'} . "/hook:xend\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function xend (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - qx{../src/task rc:hook.rc do 1}; - $output = qx{../src/task rc:hook.rc completed}; - - like ($output, qr/<\d+\/\d+\/\d+>/, 'format-end hook end -> '); -} -else -{ - pass ('format-end hook end -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-entry.t b/test/hook.format-entry.t deleted file mode 100755 index c75522184..000000000 --- a/test/hook.format-entry.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-entry=" . $ENV{'PWD'} . "/hook:entry\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function entry (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr/<\d+\/\d+\/\d+>/, 'format-entry hook entry -> '); -} -else -{ - pass ('format-entry hook entry -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-id.t b/test/hook.format-id.t deleted file mode 100755 index ef77c6a1d..000000000 --- a/test/hook.format-id.t +++ /dev/null @@ -1,87 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 9; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-id=" . $ENV{'PWD'} . "/hook:priority\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function priority (name, value)\n", - " value = '(' .. value .. ')'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - qx{../src/task rc:hook.rc add bar}; - $output = qx{../src/task rc:hook.rc ls}; - - like ($output, qr/\(1\)\s+foo/, 'format-id hook 1 -> (1)'); - like ($output, qr/\(2\)\s+bar/, 'format-id hook 2 -> (2)'); -} -else -{ - pass ('format-id hook 1 -> (1) - skip: no Lua support'); - pass ('format-id hook 2 -> (2) - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-priority-long.t b/test/hook.format-priority-long.t deleted file mode 100755 index e543819c9..000000000 --- a/test/hook.format-priority-long.t +++ /dev/null @@ -1,98 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 10; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-priority_long=" . $ENV{'PWD'} . "/hook:priority\n", - "report.ls.columns=id,project,priority_long,description\n", - "report.ls.sort=priority_long-,project+\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function priority (name, value)\n", - " if value == 'High' then\n", - " value = '^^^^'\n", - " elseif value == 'Medium' then\n", - " value = '===='\n", - " elseif value == 'Low' then\n", - " value = 'vvvv'\n", - " end\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo pri:H}; - qx{../src/task rc:hook.rc add bar pri:M}; - qx{../src/task rc:hook.rc add baz pri:L}; - $output = qx{../src/task rc:hook.rc ls}; - - like ($output, qr/\^\^\^\^\s+foo/, 'format-priority_long hook High -> ^^^^'); - like ($output, qr/====\s+bar/, 'format-priority_long hook Medium -> ===='); - like ($output, qr/vvvv\s+baz/, 'format-priority_long hook Low -> vvvv'); -} -else -{ - pass ('format-priority_long hook High -> ^^^^ - skip: no Lua support'); - pass ('format-priority_long hook Medium -> ==== - skip: no Lua support'); - pass ('format-priority_long hook Low -> vvvv - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-priority.t b/test/hook.format-priority.t deleted file mode 100755 index 3210c1e32..000000000 --- a/test/hook.format-priority.t +++ /dev/null @@ -1,96 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 10; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-priority=" . $ENV{'PWD'} . "/hook:priority\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function priority (name, value)\n", - " if value == 'H' then\n", - " value = 'Hi'\n", - " elseif value == 'M' then\n", - " value = 'Me'\n", - " elseif value == 'L' then\n", - " value = 'Lo'\n", - " end\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo pri:H}; - qx{../src/task rc:hook.rc add bar pri:M}; - qx{../src/task rc:hook.rc add baz pri:L}; - $output = qx{../src/task rc:hook.rc ls}; - - like ($output, qr/Hi\s+foo/, 'format-priority hook H -> Hi'); - like ($output, qr/Me\s+bar/, 'format-priority hook M -> Me'); - like ($output, qr/Lo\s+baz/, 'format-priority hook L -> Lo'); -} -else -{ - pass ('format-priority hook H -> Hi - skip: no Lua support'); - pass ('format-priority hook M -> Me - skip: no Lua support'); - pass ('format-priority hook L -> Lo - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-project.t b/test/hook.format-project.t deleted file mode 100755 index 65d3eb9d0..000000000 --- a/test/hook.format-project.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-project=" . $ENV{'PWD'} . "/hook:project\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function project (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo project:bar}; - $output = qx{../src/task rc:hook.rc list}; - - like ($output, qr//, 'format-project hook project -> '); -} -else -{ - pass ('format-project hook project -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-prompt.t b/test/hook.format-prompt.t deleted file mode 100755 index ac1d5c75c..000000000 --- a/test/hook.format-prompt.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "shell.prompt=foo\n", - "default.command=_version\n", - "hooks=on\n", - "hook.format-prompt=" . $ENV{'PWD'} . "/hook:prompt\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function prompt (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - my $output = qx{echo "-- \\nquit\\n" | ../src/task rc:hook.rc shell}; - like ($output, qr//, 'format-prompt hook prompt -> '); -} -else -{ - pass ('format-prompt hook prompt -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-recur.t b/test/hook.format-recur.t deleted file mode 100755 index 40fcce011..000000000 --- a/test/hook.format-recur.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-recur=" . $ENV{'PWD'} . "/hook:recur\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function recur (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo due:tomorrow recur:weekly}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr//, 'format-recur hook recur -> '); -} -else -{ - pass ('format-recur hook recur -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-start.t b/test/hook.format-start.t deleted file mode 100755 index 7367eb7e7..000000000 --- a/test/hook.format-start.t +++ /dev/null @@ -1,85 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-start=" . $ENV{'PWD'} . "/hook:start\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function start (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - qx{../src/task rc:hook.rc start 1}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr/<\d+\/\d+\/\d+>/, 'format-start hook start -> '); -} -else -{ - pass ('format-start hook start -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-tags.t b/test/hook.format-tags.t deleted file mode 100755 index ce5c7f81a..000000000 --- a/test/hook.format-tags.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-tags=" . $ENV{'PWD'} . "/hook:tags\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function tags (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo +t1 +t2}; - $output = qx{../src/task rc:hook.rc long}; - - like ($output, qr//, 'format-tags hook t1 t2 -> '); -} -else -{ - pass ('format-tags hook t1 t2 -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-uuid.t b/test/hook.format-uuid.t deleted file mode 100755 index 0aa6fe880..000000000 --- a/test/hook.format-uuid.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-uuid=" . $ENV{'PWD'} . "/hook:uuid\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function uuid (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc info 1}; - - like ($output, qr/UUID\s+<[0-9a-f-]+>/, 'format-uuid hook uuid -> '); -} -else -{ - pass ('format-uuid hook uuid -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.format-wait.t b/test/hook.format-wait.t deleted file mode 100755 index 4ffb988e8..000000000 --- a/test/hook.format-wait.t +++ /dev/null @@ -1,84 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 8; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n", - "hook.format-wait=" . $ENV{'PWD'} . "/hook:wait\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function wait (name, value)\n", - " value = '<' .. value .. '>'\n", - " return value, 0, nil\n", - "end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - qx{../src/task rc:hook.rc add foo wait:tomorrow}; - $output = qx{../src/task rc:hook.rc waiting}; - - like ($output, qr/<\d+\/\d+\/\d+>/, 'format-wait hook wait -> '); -} -else -{ - pass ('format-wait hook wait -> - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; - diff --git a/test/hook.pre-completed.t b/test/hook.pre-completed.t deleted file mode 100755 index 4cbeb5cf8..000000000 --- a/test/hook.pre-completed.t +++ /dev/null @@ -1,89 +0,0 @@ -#! /usr/bin/perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -## 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 => 9; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "hooks=on\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -# Create the hook functions. -if (open my $fh, '>', 'hook') -{ - print $fh "function good () print ('marker') return 0, nil end\n", - "function bad () print ('marker') return 1, 'disallowed' end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version}; -if ($output =~ /PUC-Rio/) -{ - my $good = $ENV{'PWD'} . '/hook:good'; - my $bad = $ENV{'PWD'} . '/hook:bad'; - - qx{echo '-- y'|../src/task rc:hook.rc config -- hook.pre-completed "$bad"}; - qx{../src/task rc:hook.rc add foo}; - $output = qx{../src/task rc:hook.rc done 1}; - like ($output, qr/disallowed/, 'pre-completed hook rejected completion'); - - qx{echo '-- y'|../src/task rc:hook.rc config -- hook.pre-completed "$good"}; - $output = qx{../src/task rc:hook.rc done 1}; - like ($output, qr/Marked 1 task as done/, 'pre-completed hook allowed completion'); -} -else -{ - pass ('pre-complete hook rejected completion - skip: no Lua support'); - pass ('pre-complete hook allowed completion - skip: no Lua support'); -} - -# Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.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; -