mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug #347 - Confirmation dialog is lowercase for "all"
- changed confirmation to be now "All" for multiple changes - added unit tests for all answers to multiple changes
This commit is contained in:
parent
7acef0c9fd
commit
b684ded845
3 changed files with 39 additions and 5 deletions
|
@ -23,6 +23,8 @@
|
|||
due dates, which are no longer relevant to a completed task (thanks to
|
||||
Cory Donnelly).
|
||||
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
||||
+ Fixed bug #347 which used only a lowercase "all" to confirm multiple changes
|
||||
instead of an uppercase "All" like the "Yes" answer.
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 27;
|
||||
use Test::More tests => 47;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'confirm.rc')
|
||||
|
@ -91,6 +91,38 @@ $output = qx{echo "N" | ../task rc:confirm.rc del 7};
|
|||
like ($output, qr/Permanently delete task 7 'foo'\? \(y\/n\)/, 'confirmation - N works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - N works');
|
||||
|
||||
# Test Yes for multiple changes
|
||||
$output = qx{echo -e "y\nY\nY\nY\nY" | ../task rc:confirm.rc 7-10 +bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 8 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 9 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 10 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Modified 4 tasks/, 'multiple confirmations - Y works');
|
||||
|
||||
# Test no for multiple changes
|
||||
$output = qx{echo -e "N\nn\nn\nn\nn" | ../task rc:confirm.rc 7-10 -bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 8 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 9 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 10 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Modified 0 tasks/, 'multiple confirmations - n works');
|
||||
|
||||
# Test All for multiple changes
|
||||
$output = qx{echo -e "a\nA" | ../task rc:confirm.rc 7-10 -bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - A works');
|
||||
unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Modified 4 tasks/, 'multiple confirmations - A works');
|
||||
|
||||
# Test quit for multiple changes
|
||||
$output = qx{echo "q" | ../task rc:confirm.rc 7-10 +bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - q works');
|
||||
unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Modified 0 tasks/, 'multiple confirmations - q works');
|
||||
|
||||
# Test newlines.
|
||||
$output = qx{cat response.txt | ../task rc:confirm.rc del 7};
|
||||
like ($output, qr/(Permanently delete task 7 'foo'\? \(y\/n\)) \1 \1/, 'confirmation - \n re-prompt works');
|
||||
|
|
|
@ -84,7 +84,7 @@ int confirm3 (const std::string& question)
|
|||
std::vector <std::string> options;
|
||||
options.push_back ("Yes");
|
||||
options.push_back ("no");
|
||||
options.push_back ("all");
|
||||
options.push_back ("All");
|
||||
|
||||
std::string answer;
|
||||
std::vector <std::string> matches;
|
||||
|
@ -105,7 +105,7 @@ int confirm3 (const std::string& question)
|
|||
while (matches.size () != 1);
|
||||
|
||||
if (matches[0] == "Yes") return 1;
|
||||
else if (matches[0] == "all") return 2;
|
||||
else if (matches[0] == "All") return 2;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ int confirm4 (const std::string& question)
|
|||
std::vector <std::string> options;
|
||||
options.push_back ("Yes");
|
||||
options.push_back ("no");
|
||||
options.push_back ("all");
|
||||
options.push_back ("All");
|
||||
options.push_back ("quit");
|
||||
|
||||
std::string answer;
|
||||
|
@ -142,7 +142,7 @@ int confirm4 (const std::string& question)
|
|||
while (matches.size () != 1);
|
||||
|
||||
if (matches[0] == "Yes") return 1;
|
||||
else if (matches[0] == "all") return 2;
|
||||
else if (matches[0] == "All") return 2;
|
||||
else if (matches[0] == "quit") return 3;
|
||||
else return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue