mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 09:53:08 +02:00
Feature Pulled
- Removed the feature that allows commands to be piped in to stdin, and appended to any existing command line. This feature is conditionally compiled, controlled by the FEATURE_STDIN define in main.h - Many unit tests contained "echo '-- y'", and now use "echo 'y'" because the '--' is no longer supported on stdin. - Thanks to the IRC team for testing, including Bryce Harrington, Sam Stuck, Owen Clarke, Greg Grossmeier.
This commit is contained in:
parent
80d6655709
commit
ac4d90f1f6
18 changed files with 66 additions and 65 deletions
|
@ -6,10 +6,7 @@
|
|||
# Untracked Features, biggest first.
|
||||
+ autoconf eliminated.
|
||||
+ New 'ids' command that returns a filtered set of task ID numbers, instead
|
||||
of the actual tasks. Similarly there is a 'uuids' commands. For advanced
|
||||
pipeline use.
|
||||
+ Now supplements the command line with data read from standard input, which
|
||||
allows commands like: echo 'add Pay the bills' | task
|
||||
of the actual tasks. Similarly there is a 'uuids' commands.
|
||||
+ Corrected sorting to use std::stable_sort instead of std::sort, which is not
|
||||
guaranteed stable (thanks to Stefan Hacker).
|
||||
+ Enhanced diagnostics command.
|
||||
|
|
5
NEWS
5
NEWS
|
@ -2,10 +2,7 @@
|
|||
New Features in taskwarrior 2.0.0
|
||||
|
||||
- New 'ids' command that returns a filtered set of task ID numbers, instead
|
||||
of the actual tasks. Similarly, there is a 'uuids' command. For advanced
|
||||
pipeline use.
|
||||
- Now supplements the command line with data read from standard input, which
|
||||
allows commands like: echo 'add Pay the bills' | task
|
||||
of the actual tasks. Similarly, there is a 'uuids' command.
|
||||
- Attribute modifiers may be prefixed with '~' to return the opposite of a
|
||||
filter's results.
|
||||
- Status attribute can now be used in report.
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/select.h>
|
||||
#include <Context.h>
|
||||
#include <Directory.h>
|
||||
#include <Date.h>
|
||||
|
@ -41,9 +40,14 @@
|
|||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <i18n.h>
|
||||
#include <main.h>
|
||||
#include <A3.h>
|
||||
#include <cmake.h>
|
||||
|
||||
#ifdef FEATURE_STDIN
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
extern Context context;
|
||||
|
||||
// Supported modifiers, synonyms on the same line.
|
||||
|
@ -279,6 +283,7 @@ bool A3::is_command (
|
|||
// Add an Arg for every word from std::cin.
|
||||
void A3::append_stdin ()
|
||||
{
|
||||
#ifdef FEATURE_STDIN
|
||||
// Use 'select' to determine whether there is any std::cin content buffered
|
||||
// before trying to read it, to prevent blocking.
|
||||
struct timeval tv;
|
||||
|
@ -305,6 +310,7 @@ void A3::append_stdin ()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define L10N // Localization complete.
|
||||
|
||||
#define FEATURE_COLOR 1 // Enable color.
|
||||
//#define FEATURE_STDIN 1 // Enable reading stdin.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -45,7 +45,7 @@ qx{../src/task rc:bug.rc ls};
|
|||
|
||||
# Result: trying to add the project generates an error about removing
|
||||
# recurrence from a task.
|
||||
my $output = qx{echo '-- y' | ../src/task rc:bug.rc 1 modify project:bar};
|
||||
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 modify project:bar};
|
||||
unlike ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'No recurrence removal error');
|
||||
|
||||
# Now try to generate the error above via regular means - ie, is it actually
|
||||
|
|
|
@ -45,7 +45,7 @@ if (open my $fh, '>', 'bug.rc')
|
|||
qx{../src/task rc:bug.rc add One project:p1};
|
||||
|
||||
# Delete the task and note the completion status of the project.
|
||||
my $output = qx{echo '-- y' | ../src/task rc:bug.rc 1 delete};
|
||||
my $output = qx{echo 'y' | ../src/task rc:bug.rc 1 delete};
|
||||
like ($output, qr/is 0\% complete/ms, 'Empty project correctly reported as being 0% completed.');
|
||||
|
||||
# Add another task, complete it and note the completion status of hte project.
|
||||
|
|
|
@ -45,7 +45,7 @@ if (open my $fh, '>', 'bug.rc')
|
|||
qx{../src/task rc:bug.rc add Test};
|
||||
|
||||
# Result: Attempt to undo add with confirmation=off
|
||||
my $output = qx{echo '-- n' |../src/task rc:bug.rc rc.confirmation=off undo};
|
||||
my $output = qx{echo 'n' |../src/task rc:bug.rc rc.confirmation=off undo};
|
||||
unlike ($output, qr/Are you sure/ms, 'Undo honours confirmation=off.');
|
||||
|
||||
# Cleanup.
|
||||
|
|
|
@ -49,13 +49,13 @@ like ($output, qr/2.+R/ms, 'Found child 0');
|
|||
like ($output, qr/3.+R/ms, 'Found child 1');
|
||||
like ($output, qr/4.+R/ms, 'Found child 2');
|
||||
|
||||
qx{echo '-- y' | ../src/task rc:bug.rc 2 mod project:P};
|
||||
qx{echo 'y' | ../src/task rc:bug.rc 2 mod project:P};
|
||||
$output = qx{../src/task rc:bug.rc list};
|
||||
like ($output, qr/2\s+P.+R/ms, 'Found modified child 0');
|
||||
like ($output, qr/3\s+P.+R/ms, 'Found modified child 1 (propagated from 0)');
|
||||
like ($output, qr/4\s+P.+R/ms, 'Found modified child 2 (propagated from 0)');
|
||||
|
||||
qx{echo '-- y' | ../src/task rc:bug.rc 1 mod priority:H};
|
||||
qx{echo 'y' | ../src/task rc:bug.rc 1 mod priority:H};
|
||||
$output = qx{../src/task rc:bug.rc list};
|
||||
like ($output, qr/2\s+P.+H.+R/ms, 'Found modified child 0 (propagated from parent');
|
||||
like ($output, qr/3\s+P.+H.+R/ms, 'Found modified child 1 (propagated from parent)');
|
||||
|
|
|
@ -44,10 +44,10 @@ my $output = qx{../src/task rc:bug.rc 1 annotate};
|
|||
like ($output, qr/Additional text must be provided/, 'failed on blank annotation');
|
||||
|
||||
# Attempt an annotation without ID
|
||||
$output = qx{echo "-- n" | ../src/task rc:bug.rc annotate bar};
|
||||
$output = qx{echo "n" | ../src/task rc:bug.rc annotate bar};
|
||||
like ($output, qr/Command prevented from running/, 'Filter-less write command inhibited');
|
||||
|
||||
$output = qx{echo "-- y" | ../src/task rc:bug.rc annotate bar};
|
||||
$output = qx{echo "y" | ../src/task rc:bug.rc annotate bar};
|
||||
unlike ($output, qr/Command prevented from running/, 'Filter-less write command permitted');
|
||||
|
||||
# Cleanup.
|
||||
|
|
|
@ -49,10 +49,10 @@ qx{../src/task rc:bulk.rc add t4 due:thursday};
|
|||
qx{../src/task rc:bulk.rc add t5 due:friday};
|
||||
qx{../src/task rc:bulk.rc add t6 due:saturday};
|
||||
|
||||
my $output = qx{echo "-- quit"|../src/task rc:bulk.rc 4 5 6 modify pro:p1 pri:M};
|
||||
my $output = qx{echo "quit"|../src/task rc:bulk.rc 4 5 6 modify pro:p1 pri:M};
|
||||
like ($output, qr/Modified 0 tasks/, '"quit" prevents any further modifications');
|
||||
|
||||
$output = qx{echo "-- All"|../src/task rc:bulk.rc 4 5 6 mod pro:p1 pri:M};
|
||||
$output = qx{echo "All"|../src/task rc:bulk.rc 4 5 6 mod pro:p1 pri:M};
|
||||
unlike ($output, qr/Task 4 "t4"\n - No changes were made/, 'Task 4 modified');
|
||||
unlike ($output, qr/Task 5 "t5"\n - No changes were made/, 'Task 5 modified');
|
||||
unlike ($output, qr/Task 6 "t6"\n - No changes were made/, 'Task 6 modified');
|
||||
|
|
22
test/bulk.t
22
test/bulk.t
|
@ -66,38 +66,38 @@ qx{../src/task rc:bulk.rc add eighteen};
|
|||
# 'yes' tests:
|
||||
|
||||
# Test with 1 task. 1 is a special case.
|
||||
my $output = qx{echo '-- y' | ../src/task rc:bulk.rc rc.confirmation=off 1 delete};
|
||||
my $output = qx{echo 'y' | ../src/task rc:bulk.rc rc.confirmation=off 1 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Single delete with no confirmation');
|
||||
unlike ($output, qr/\(yes\/no\/all\/quit\)/, 'Single delete with no bulk confirmation');
|
||||
like ($output, qr/Deleting task 1/, 'Verified delete 1');
|
||||
|
||||
$output = qx{echo '-- y' | ../src/task rc:bulk.rc rc.confirmation=on 2 delete};
|
||||
$output = qx{echo 'y' | ../src/task rc:bulk.rc rc.confirmation=on 2 delete};
|
||||
like ($output, qr/\(yes\/no\)/, 'Single delete with confirmation');
|
||||
unlike ($output, qr/\(yes\/no\/all\/quit\)/, 'Single delete with no bulk confirmation');
|
||||
like ($output, qr/Deleting task 2/, 'Verified delete 2');
|
||||
|
||||
# Test with 2 tasks. 2 is greater than 1 and less than bulk.
|
||||
$output = qx{echo '-- y' | ../src/task rc:bulk.rc rc.confirmation=off 3-4 delete};
|
||||
$output = qx{echo 'y' | ../src/task rc:bulk.rc rc.confirmation=off 3-4 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Multiple delete with no confirmation');
|
||||
unlike ($output, qr/\(yes\/no\/all\/quit\)/, 'Multiple delete with no bulk confirmation');
|
||||
like ($output, qr/Deleting task 3/, 'Verified delete 3');
|
||||
like ($output, qr/Deleting task 4/, 'Verified delete 4');
|
||||
|
||||
$output = qx{echo -e ' -- y\ny\n' | ../src/task rc:bulk.rc rc.confirmation=on 5-6 delete};
|
||||
$output = qx{printf 'y\ny\n' | ../src/task rc:bulk.rc rc.confirmation=on 5-6 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Multiple delete with confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Multiple delete with bulk confirmation');
|
||||
like ($output, qr/Deleting task 5/, 'Verified delete 5');
|
||||
like ($output, qr/Deleting task 6/, 'Verified delete 6');
|
||||
|
||||
# Test with 3 tasks. 3 is considered bulk.
|
||||
$output = qx{echo -e ' -- y\ny\ny\n' | ../src/task rc:bulk.rc rc.confirmation=off 7-9 delete};
|
||||
$output = qx{printf 'y\ny\ny\n' | ../src/task rc:bulk.rc rc.confirmation=off 7-9 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Bulk delete with no confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Bulk delete with no bulk confirmation');
|
||||
like ($output, qr/Deleting task 7/, 'Verified delete 7');
|
||||
like ($output, qr/Deleting task 8/, 'Verified delete 8');
|
||||
like ($output, qr/Deleting task 9/, 'Verified delete 9');
|
||||
|
||||
$output = qx{echo -e ' -- y\ny\ny\n' | ../src/task rc:bulk.rc rc.confirmation=on 10-12 delete};
|
||||
$output = qx{printf 'y\ny\ny\n' | ../src/task rc:bulk.rc rc.confirmation=on 10-12 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Bulk delete with confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Bulk delete with bulk confirmation');
|
||||
like ($output, qr/Deleting task 10/, 'Verified delete 10');
|
||||
|
@ -107,25 +107,25 @@ like ($output, qr/Deleting task 12/, 'Verified delete 12');
|
|||
# 'no' tests:
|
||||
|
||||
# Test with 1 task, denying delete.
|
||||
$output = qx{echo '-- n' | ../src/task rc:bulk.rc rc.confirmation=on 13 delete};
|
||||
$output = qx{echo 'n' | ../src/task rc:bulk.rc rc.confirmation=on 13 delete};
|
||||
like ($output, qr/\(yes\/no\)/, 'Single delete with confirmation');
|
||||
unlike ($output, qr/\(yes\/no\/all\/quit\)/, 'Single delete with no bulk confirmation');
|
||||
unlike ($output, qr/Deleting task/, 'Verified no delete 13');
|
||||
|
||||
# Test with 2 tasks, denying delete.
|
||||
$output = qx{echo -e ' -- n\nn\n' | ../src/task rc:bulk.rc rc.confirmation=on 13-14 delete};
|
||||
$output = qx{printf 'n\nn\n' | ../src/task rc:bulk.rc rc.confirmation=on 13-14 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Multiple delete with confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Multiple delete with no bulk confirmation');
|
||||
unlike ($output, qr/Deleting task/, 'Verified no delete 13-14');
|
||||
|
||||
# Test with 3 tasks, denying delete.
|
||||
$output = qx{echo -e ' -- n\nn\nn\n' | ../src/task rc:bulk.rc rc.confirmation=on 13-15 delete};
|
||||
$output = qx{printf 'n\nn\nn\n' | ../src/task rc:bulk.rc rc.confirmation=on 13-15 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Bulk delete with confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Bulk delete with no bulk confirmation');
|
||||
unlike ($output, qr/Deleting task/, 'Verified no delete 13-15');
|
||||
|
||||
# 'all' tests:
|
||||
$output = qx{echo '-- all' | ../src/task rc:bulk.rc rc.confirmation=on 13-15 delete};
|
||||
$output = qx{echo 'all' | ../src/task rc:bulk.rc rc.confirmation=on 13-15 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Bulk delete with confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Bulk delete with bulk confirmation');
|
||||
like ($output, qr/Deleting task/, 'Verified delete 13');
|
||||
|
@ -133,7 +133,7 @@ like ($output, qr/Deleting task/, 'Verified delete 14');
|
|||
like ($output, qr/Deleting task/, 'Verified delete 15');
|
||||
|
||||
# 'quit' tests:
|
||||
$output = qx{echo '-- quit' | ../src/task rc:bulk.rc rc.confirmation=on 16-18 delete};
|
||||
$output = qx{echo 'quit' | ../src/task rc:bulk.rc rc.confirmation=on 16-18 delete};
|
||||
unlike ($output, qr/\(yes\/no\)/, 'Bulk delete with no confirmation');
|
||||
like ($output, qr/\(yes\/no\/all\/quit\)/, 'Bulk delete with no bulk confirmation');
|
||||
unlike ($output, qr/Deleting task/, 'Verified delete 16');
|
||||
|
|
|
@ -42,7 +42,7 @@ if (open my $fh, '>', 'confirm.rc')
|
|||
# Create the response file.
|
||||
if (open my $fh, '>', 'response.txt')
|
||||
{
|
||||
print $fh "-- \n\nn\n";
|
||||
print $fh "\n\nn\n";
|
||||
close $fh;
|
||||
ok (-r 'response.txt', 'Created response.txt');
|
||||
}
|
||||
|
@ -50,44 +50,44 @@ if (open my $fh, '>', 'response.txt')
|
|||
qx{../src/task rc:confirm.rc add foo} for 1..10;
|
||||
|
||||
# Test the various forms of "Yes".
|
||||
my $output = qx{echo "-- Yes" | ../src/task rc:confirm.rc 1 del};
|
||||
my $output = qx{echo "Yes" | ../src/task rc:confirm.rc 1 del};
|
||||
like ($output, qr/Permanently delete task 1 'foo'\? \(yes\/no\)/, 'confirmation - Yes works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - Yes works');
|
||||
|
||||
$output = qx{echo "-- ye" | ../src/task rc:confirm.rc 2 del};
|
||||
$output = qx{echo "ye" | ../src/task rc:confirm.rc 2 del};
|
||||
like ($output, qr/Permanently delete task 2 'foo'\? \(yes\/no\)/, 'confirmation - ye works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - ye works');
|
||||
|
||||
$output = qx{echo "-- y" | ../src/task rc:confirm.rc 3 del};
|
||||
$output = qx{echo "y" | ../src/task rc:confirm.rc 3 del};
|
||||
like ($output, qr/Permanently delete task 3 'foo'\? \(yes\/no\)/, 'confirmation - y works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - y works');
|
||||
|
||||
$output = qx{echo "-- YES" | ../src/task rc:confirm.rc 4 del};
|
||||
$output = qx{echo "YES" | ../src/task rc:confirm.rc 4 del};
|
||||
like ($output, qr/Permanently delete task 4 'foo'\? \(yes\/no\)/, 'confirmation - YES works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - YES works'); # 10
|
||||
|
||||
$output = qx{echo "-- YE" | ../src/task rc:confirm.rc 5 del};
|
||||
$output = qx{echo "YE" | ../src/task rc:confirm.rc 5 del};
|
||||
like ($output, qr/Permanently delete task 5 'foo'\? \(yes\/no\)/, 'confirmation - YE works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - YE works');
|
||||
|
||||
$output = qx{echo "-- Y" | ../src/task rc:confirm.rc 6 del};
|
||||
$output = qx{echo "Y" | ../src/task rc:confirm.rc 6 del};
|
||||
like ($output, qr/Permanently delete task 6 'foo'\? \(yes\/no\)/, 'confirmation - Y works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - Y works');
|
||||
|
||||
# Test the various forms of "no".
|
||||
$output = qx{echo "-- no" | ../src/task rc:confirm.rc 7 del};
|
||||
$output = qx{echo "no" | ../src/task rc:confirm.rc 7 del};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(yes\/no\)/, 'confirmation - no works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - no works');
|
||||
|
||||
$output = qx{echo "-- n" | ../src/task rc:confirm.rc 7 del};
|
||||
$output = qx{echo "n" | ../src/task rc:confirm.rc 7 del};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(yes\/no\)/, 'confirmation - n works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - n works');
|
||||
|
||||
$output = qx{echo "-- NO" | ../src/task rc:confirm.rc 7 del};
|
||||
$output = qx{echo "NO" | ../src/task rc:confirm.rc 7 del};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(yes\/no\)/, 'confirmation - NO works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - NO works'); # 20
|
||||
|
||||
$output = qx{echo "-- N" | ../src/task rc:confirm.rc 7 del};
|
||||
$output = qx{echo "N" | ../src/task rc:confirm.rc 7 del};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(yes\/no\)/, 'confirmation - N works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - N works');
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ $output = qx{../src/task rc:default.rc};
|
|||
like ($output, qr/1 PROJECT L .+ priority specified/, 'default command worked');
|
||||
|
||||
qx{../src/task rc:default.rc add project:HOME priority:M due:tomorrow all specified};
|
||||
qx{echo '-- y' | ../src/task rc:default.rc config default.command 'list priority:M'};
|
||||
qx{echo 'y' | ../src/task rc:default.rc config default.command 'list priority:M'};
|
||||
$output = qx{../src/task rc:default.rc};
|
||||
like ($output, qr/ M /, 'priority:M included in default command');
|
||||
unlike ($output, qr/ L /, 'priority:L excluded from default command');
|
||||
|
|
|
@ -49,7 +49,7 @@ $output = qx{../src/task rc:delete.rc 1 delete; ../src/task rc:delete.rc info 1}
|
|||
like ($output, qr/Status\s+Deleted\n/, 'Deleted');
|
||||
ok (-r 'completed.data', 'completed.data created');
|
||||
|
||||
$output = qx{echo '-- y' | ../src/task rc:delete.rc undo; ../src/task rc:delete.rc info 1};
|
||||
$output = qx{echo 'y' | ../src/task rc:delete.rc undo; ../src/task rc:delete.rc info 1};
|
||||
like ($output, qr/Status\s+Pending\n/, 'Pending');
|
||||
ok (-r 'completed.data', 'completed.data created');
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ qx{../src/task rc:dep.rc add Six recurring due:tomorrow recur:daily};
|
|||
|
||||
# [20]
|
||||
qx{../src/task rc:dep.rc ls}; # To force handleRecurrence call.
|
||||
$output = qx{echo '-- y' | ../src/task rc:dep.rc 6 modify dep:5};
|
||||
$output = qx{echo 'y' | ../src/task rc:dep.rc 6 modify dep:5};
|
||||
like ($output, qr/Modified \d+ task/, 'dependencies - recurring task depending on another task');
|
||||
|
||||
# [21]
|
||||
|
@ -175,16 +175,16 @@ qx{../src/task rc:dep.rc add Four};
|
|||
qx{../src/task rc:dep.rc 2 modify dep:1; ../src/task rc:dep.rc 3 modify dep:2; ../src/task rc:dep.rc 4 modify dep:3};
|
||||
|
||||
# [30,31]
|
||||
$output = qx{echo '-- y' | ../src/task rc:dep.rc 2 do};
|
||||
$output = qx{echo 'y' | ../src/task rc:dep.rc 2 do};
|
||||
like ($output, qr/fixed/, 'dependencies - user prompted to fix broken chain after completing a blocked task');
|
||||
like ($output, qr/is blocked by/, 'dependencies - user nagged for completing a blocked task');
|
||||
|
||||
# [32]
|
||||
$output = qx{echo '-- y' | ../src/task rc:dep.rc 1 do};
|
||||
$output = qx{echo 'y' | ../src/task rc:dep.rc 1 do};
|
||||
unlike ($output, qr/fixed/, 'dependencies - user not prompted to fix broken chain when the head of the chain is marked as complete');
|
||||
|
||||
# [33]
|
||||
$output = qx{echo '-- y' | ../src/task rc:dep.rc 4 del};
|
||||
$output = qx{echo 'y' | ../src/task rc:dep.rc 4 del};
|
||||
unlike ($output, qr/fixed/, 'dependencies - user not prompted to fix broken chain when the tail of the chain is deleted');
|
||||
|
||||
# [34]
|
||||
|
@ -203,12 +203,12 @@ qx{../src/task rc:dep.rc 4 modify dep:3};
|
|||
qx{../src/task rc:dep.rc 5 modify dep:4};
|
||||
|
||||
# [35]
|
||||
qx{echo '-- y' | ../src/task rc:dep.rc 2 do};
|
||||
qx{echo 'y' | ../src/task rc:dep.rc 2 do};
|
||||
$output = qx{../src/task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+One\s*\n\s2\s+1\s+Three\s*\n\s3\s+2\s+Four\s*\n\s4\s+3\s+Five/, 'dependencies - fixed chain after completing a blocked task');
|
||||
|
||||
# [36]
|
||||
qx{echo "-- Y\nY\n" | ../src/task rc:dep.rc 2 del};
|
||||
qx{echo "Y\nY\n" | ../src/task rc:dep.rc 2 del};
|
||||
$output = qx{../src/task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+One\s*\n\s2\s+1\s+Four\s*\n\s3\s+2\s+Five/, 'dependencies - fixed chain after deleting a blocked task');
|
||||
|
||||
|
|
18
test/rc.t
18
test/rc.t
|
@ -34,7 +34,7 @@ use Test::More tests => 15;
|
|||
# Create the rc file, using rc.name:value.
|
||||
unlink 'foo.rc';
|
||||
rmtree 'foo', 0, 0;
|
||||
qx{echo '-- y'|../src/task rc:foo.rc rc.data.location:foo};
|
||||
qx{echo 'y'|../src/task rc:foo.rc rc.data.location:foo};
|
||||
|
||||
ok (-r 'foo.rc', 'Created default rc file');
|
||||
ok (-d 'foo', 'Created default data directory');
|
||||
|
@ -46,40 +46,40 @@ unlink 'foo.rc';
|
|||
ok (!-r 'foo.rc', 'Removed foo.rc');
|
||||
|
||||
# Do it all again, with rc.name=value.
|
||||
qx{echo '-- y'|../src/task rc:foo.rc rc.data.location:foo};
|
||||
qx{echo 'y'|../src/task rc:foo.rc rc.data.location:foo};
|
||||
|
||||
ok (-r 'foo.rc', 'Created default rc file');
|
||||
ok (-d 'foo', 'Created default data directory');
|
||||
|
||||
# Add a setting.
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config must_be_unique old};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config must_be_unique old};
|
||||
my $output = qx{../src/task rc:foo.rc show};
|
||||
like ($output, qr/^must_be_unique\s+old/ms, 'config setting a new value');
|
||||
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config must_be_unique new};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config must_be_unique new};
|
||||
$output = qx{../src/task rc:foo.rc show};
|
||||
like ($output, qr/^must_be_unique\s+new/ms, 'config overwriting an existing value');
|
||||
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config must_be_unique ''};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config must_be_unique ''};
|
||||
$output = qx{../src/task rc:foo.rc show};
|
||||
like ($output, qr/^must_be_unique/ms, 'config setting a blank value');
|
||||
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config must_be_unique};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config must_be_unique};
|
||||
$output = qx{../src/task rc:foo.rc show};
|
||||
unlike ($output, qr/^must_be_unique/ms, 'config removing a value');
|
||||
|
||||
# 'report.:b' is designed to get past the config command checks for recognized
|
||||
# names.
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config -- report.:b +c};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config -- report.:b +c};
|
||||
$output = qx{../src/task rc:foo.rc show};
|
||||
like ($output, qr/^report\.:b\s+\+c/ms, 'the -- operator is working');
|
||||
|
||||
# Make sure the value is accepted if it has multiple words.
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config must_be_unique 'one two three'};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config must_be_unique 'one two three'};
|
||||
$output = qx{../src/task rc:foo.rc show};
|
||||
like ($output, qr/^must_be_unique\s+one two three/ms, 'config allows multi-word quoted values');
|
||||
|
||||
qx{echo '-- y'|../src/task rc:foo.rc config must_be_unique one two three};
|
||||
qx{echo 'y'|../src/task rc:foo.rc config must_be_unique one two three};
|
||||
$output = qx{../src/task rc:foo.rc show};
|
||||
like ($output, qr/^must_be_unique\s+one two three/ms, 'config allows multi-word unquoted values');
|
||||
|
||||
|
|
10
test/recur.t
10
test/recur.t
|
@ -54,7 +54,7 @@ like ($output, qr/3.+complex\n/ms, '3 complex');
|
|||
like ($output, qr/4.+complex\n/ms, '4 complex');
|
||||
|
||||
# Modify a child task and do not propagate the change.
|
||||
$output = qx{echo '-- n' | ../src/task rc:recur.rc 3 modify complex2};
|
||||
$output = qx{echo 'n' | ../src/task rc:recur.rc 3 modify complex2};
|
||||
$output = qx{../src/task rc:recur.rc 3 info};
|
||||
like ($output, qr/Description\s+complex2\s/ms, '3 modified');
|
||||
$output = qx{../src/task rc:recur.rc 4 info};
|
||||
|
@ -62,24 +62,24 @@ like ($output, qr/Description\s+complex\s/ms, '4 not modified');
|
|||
|
||||
|
||||
# Modify a child task and propagate the change.
|
||||
$output = qx{echo '-- y' | ../src/task rc:recur.rc 3 modify complex3};
|
||||
$output = qx{echo 'y' | ../src/task rc:recur.rc 3 modify complex3};
|
||||
$output = qx{../src/task rc:recur.rc 3 info};
|
||||
like ($output, qr/Description\s+complex3\s/ms, '3 modified');
|
||||
$output = qx{../src/task rc:recur.rc 4 info};
|
||||
like ($output, qr/Description\s+complex3\s/ms, '4 not modified');
|
||||
|
||||
# Delete a child task, not propagate.
|
||||
$output = qx{echo '-- n' | ../src/task rc:recur.rc 3 delete};
|
||||
$output = qx{echo 'n' | ../src/task rc:recur.rc 3 delete};
|
||||
like ($output, qr/Deleted 1 task\./, '3 deleted');
|
||||
|
||||
# Delete a child task, propagate.
|
||||
#$output = qx{../src/task rc:recur.rc minimal};
|
||||
#$output = qx{echo '-- y' | ../src/task rc:recur.rc 3 delete};
|
||||
#$output = qx{echo 'y' | ../src/task rc:recur.rc 3 delete};
|
||||
#like ($output, qr/Deleted 1 task\./, 'Child + parent deleted');
|
||||
#$output = qx{../src/task rc:recur.rc minimal};
|
||||
|
||||
# TODO Delete a recurring task.
|
||||
#$output = qx{echo '-- y' | ../src/task rc:recur.rc 4 delete};
|
||||
#$output = qx{echo 'y' | ../src/task rc:recur.rc 4 delete};
|
||||
#diag ('---');
|
||||
#diag ($output);
|
||||
#diag ('---');
|
||||
|
|
|
@ -42,12 +42,12 @@ if (open my $fh, '>', 'shell.rc')
|
|||
}
|
||||
|
||||
# Test the prompt.
|
||||
my $output = qx{echo "-- quit" | ../src/task rc:shell.rc shell};
|
||||
my $output = qx{echo "quit" | ../src/task rc:shell.rc shell};
|
||||
like ($output, qr/testprompt>/, 'custom prompt is being used');
|
||||
|
||||
# Test a simple add, then info.
|
||||
qx{echo "-- add foo" | ../src/task rc:shell.rc shell};
|
||||
$output = qx{echo "-- 1 info" | ../src/task rc:shell.rc shell};
|
||||
qx{echo "add foo" | ../src/task rc:shell.rc shell};
|
||||
$output = qx{echo "1 info" | ../src/task rc:shell.rc shell};
|
||||
like ($output, qr/Description\s+foo/, 'add/info working');
|
||||
|
||||
unlink 'shell.rc';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue