diff --git a/src/Att.cpp b/src/Att.cpp index b49e63a29..8e69018bc 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -239,7 +239,8 @@ bool Att::validNameValue ( autoComplete (name, candidates, matches); if (matches.size () == 0) - throw std::string ("Unrecognized attribute '") + name + "'"; +// throw std::string ("Unrecognized attribute '") + name + "'"; + return false; else if (matches.size () != 1) { diff --git a/src/Context.cpp b/src/Context.cpp index fdaad2355..cb425cb53 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -428,12 +428,26 @@ void Context::parse ( std::string name = attribute.name (); std::string mod = attribute.mod (); std::string value = attribute.value (); - attribute.validNameValue (name, mod, value); - attribute.name (name); - attribute.mod (mod); - attribute.value (value); + if (attribute.validNameValue (name, mod, value)) + { + attribute.name (name); + attribute.mod (mod); + attribute.value (value); - parseTask[attribute.name ()] = attribute; + parseTask[attribute.name ()] = attribute; + } + + // *arg has the appearance of an attribute (foo:bar), but isn't + // recognized, so downgrade it to part of the description. + else + { + if (foundSequence) + foundSomethingAfterSequence = true; + + if (descCandidate.length ()) + descCandidate += " "; + descCandidate += *arg; + } } // Substitution of description and/or annotation text. diff --git a/src/command.cpp b/src/command.cpp index 5a30dce7a..f0afa8860 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -661,11 +661,7 @@ std::string handleDone () { // Apply deltas. deltaDescription (*task); - context.task.remove ("description"); - deltaTags (*task); - context.task.remove ("tags"); - deltaAttributes (*task); deltaSubstitutions (*task); @@ -799,11 +795,7 @@ std::string handleModify () // Apply other deltas. changes += deltaDescription (*other); - context.task.remove ("description"); - changes += deltaTags (*other); - context.task.remove ("tags"); - changes += deltaAttributes (*other); changes += deltaSubstitutions (*other); @@ -853,11 +845,7 @@ std::string handleAppend () // Apply other deltas. changes += deltaAppend (*other); - context.task.remove ("description"); - changes += deltaTags (*other); - context.task.remove ("tags"); - changes += deltaAttributes (*other); if (changes) @@ -924,11 +912,7 @@ std::string handleDuplicate () // Apply deltas. deltaDescription (dup); - context.task.remove ("description"); - deltaTags (dup); - context.task.remove ("tags"); - deltaAttributes (dup); deltaSubstitutions (dup); @@ -1137,7 +1121,9 @@ int deltaAttributes (Task& task) foreach (att, context.task) { - if (att->first != "uuid") + if (att->first != "uuid" && + att->first != "description" && + att->first != "tags") { if (att->second.value () == "") task.remove (att->first); diff --git a/src/tests/att.t.cpp b/src/tests/att.t.cpp index d0b8ae459..8def0e542 100644 --- a/src/tests/att.t.cpp +++ b/src/tests/att.t.cpp @@ -210,7 +210,7 @@ int main (int argc, char** argv) n = Nibbler ("name:"); good = true; try {a7.parse (n);} catch (...) {good = false;} - t.notok (good, "Att::parse (name:)"); + t.ok (good, "Att::parse (name:)"); n = Nibbler ("name:\"value"); good = true; diff --git a/src/tests/basic.t b/src/tests/basic.t index e369b773d..475874a7d 100755 --- a/src/tests/basic.t +++ b/src/tests/basic.t @@ -41,13 +41,13 @@ if (open my $fh, '>', 'basic.rc') # Test the usage command. my $output = qx{../task rc:basic.rc}; like ($output, qr/Usage: task/, 'usage'); -like ($output, qr/http:\/\/www\.beckingham\.net\/task\.html/, 'usage - url'); +like ($output, qr/http:\/\/taskwarrior\.org/, 'usage - url'); # Test the version command. $output = qx{../task rc:basic.rc version}; like ($output, qr/task \d+\.\d+\.\d+/, 'version - task version number'); like ($output, qr/ABSOLUTELY NO WARRANTY/, 'version - warranty'); -like ($output, qr/http:\/\/www\.beckingham\.net\/task\.html/, 'version - url'); +like ($output, qr/http:\/\/taskwarrior\.org/, 'version - url'); # Cleanup. unlink 'basic.rc'; diff --git a/src/tests/benchmark.txt b/src/tests/benchmark.txt index c64d3369e..19f4c81c1 100644 --- a/src/tests/benchmark.txt +++ b/src/tests/benchmark.txt @@ -38,3 +38,16 @@ ok 3 - Removed completed.data ok 4 - Removed bench.rc +6/18/2009 + 1.8.0: + 1..4 + ok 1 - Created bench.rc + # start=1245372501 + # 1000 tasks added in 4 seconds + # 600 tasks altered in 45 seconds + # stop=1245372747 + # total=246 + ok 2 - Removed pending.data + ok 3 - Removed completed.data + ok 4 - Removed bench.rc + diff --git a/src/tests/bug.annual.t b/src/tests/bug.annual.t index 71f98e934..9e5aba068 100755 --- a/src/tests/bug.annual.t +++ b/src/tests/bug.annual.t @@ -57,14 +57,14 @@ if (open my $fh, '>', 'annual.rc') qx{../task rc:annual.rc add foo due:1/1/2000 recur:annual until:1/1/2009}; my $output = qx{../task rc:annual.rc list}; -like ($output, qr/2\s+1\/1\/2000\s+- foo/, 'synthetic 1 no creep'); -like ($output, qr/3\s+1\/1\/2001\s+- foo/, 'synthetic 2 no creep'); -like ($output, qr/4\s+1\/1\/2002\s+- foo/, 'synthetic 3 no creep'); -like ($output, qr/5\s+1\/1\/2003\s+- foo/, 'synthetic 4 no creep'); -like ($output, qr/6\s+1\/1\/2004\s+- foo/, 'synthetic 5 no creep'); -like ($output, qr/7\s+1\/1\/2005\s+- foo/, 'synthetic 6 no creep'); -like ($output, qr/8\s+1\/1\/2006\s+- foo/, 'synthetic 7 no creep'); -like ($output, qr/9\s+1\/1\/2007\s+- foo/, 'synthetic 8 no creep'); +like ($output, qr/2\s+1\/1\/2000\s+- foo/, 'synthetic 1 no creep'); +like ($output, qr/3\s+1\/1\/2001\s+- foo/, 'synthetic 2 no creep'); +like ($output, qr/4\s+1\/1\/2002\s+- foo/, 'synthetic 3 no creep'); +like ($output, qr/5\s+1\/1\/2003\s+- foo/, 'synthetic 4 no creep'); +like ($output, qr/6\s+1\/1\/2004\s+- foo/, 'synthetic 5 no creep'); +like ($output, qr/7\s+1\/1\/2005\s+- foo/, 'synthetic 6 no creep'); +like ($output, qr/8\s+1\/1\/2006\s+- foo/, 'synthetic 7 no creep'); +like ($output, qr/9\s+1\/1\/2007\s+- foo/, 'synthetic 8 no creep'); like ($output, qr/10\s+1\/1\/2008\s+- foo/, 'synthetic 9 no creep'); like ($output, qr/11\s+1\/1\/2009\s+- foo/, 'synthetic 10 no creep'); diff --git a/src/tests/default.t b/src/tests/default.t index 6851b0063..d30a1d1d1 100755 --- a/src/tests/default.t +++ b/src/tests/default.t @@ -34,7 +34,7 @@ use Test::More tests => 16; if (open my $fh, '>', 'default.rc') { print $fh "data.location=.\n", - "default.command=list\n", + "default.command=rc:default.rc list\n", "default.project=PROJECT\n", "default.priority=M\n"; close $fh; diff --git a/src/tests/delete.t b/src/tests/delete.t index 92a1f0414..35c7438b4 100755 --- a/src/tests/delete.t +++ b/src/tests/delete.t @@ -46,21 +46,21 @@ like ($output, qr/Status\s+Pending\n/, 'Pending'); $output = qx{../task rc:undelete.rc delete 1; ../task rc:undelete.rc info 1}; like ($output, qr/Status\s+Deleted\n/, 'Deleted'); -ok (! -r 'completed.data', 'completed.data not created'); +ok (-r 'completed.data', 'completed.data created'); $output = qx{../task rc:undelete.rc undelete 1; ../task rc:undelete.rc info 1}; like ($output, qr/Status\s+Pending\n/, 'Pending'); -ok (! -r 'completed.data', 'completed.data not created'); +ok (-r 'completed.data', 'completed.data created'); $output = qx{../task rc:undelete.rc delete 1; ../task rc:undelete.rc list}; -like ($output, qr/^No matches/, 'No matches'); +like ($output, qr/No matches./, 'No matches'); ok (-r 'completed.data', 'completed.data created'); $output = qx{../task rc:undelete.rc undelete 1}; like ($output, qr/Task 1 not found/, 'Task 1 not found'); $output = qx{../task rc:undelete.rc info 1}; -like ($output, qr/No matches./, 'no matches'); +like ($output, qr/Task 1 not found/, 'No matches'); # Cleanup. ok (-r 'pending.data', 'Need to remove pending.data');