mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 09:53:08 +02:00
Tests: merge op_* to operators.t and convert to Python
This commit is contained in:
parent
4164c8184b
commit
a7fa29fb65
8 changed files with 427 additions and 582 deletions
|
@ -1,90 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 24;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'op.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:op.rc add one project:A priority:H 2>&1};
|
||||
qx{../src/task rc:op.rc add two project:A 2>&1};
|
||||
qx{../src/task rc:op.rc add three priority:H 2>&1};
|
||||
qx{../src/task rc:op.rc add four 2>&1};
|
||||
|
||||
# Test the 'and' operator.
|
||||
my $output = qx{../src/task rc:op.rc ls project:A priority:H 2>&1};
|
||||
like ($output, qr/one/, 'ls project:A priority:H --> one');
|
||||
unlike ($output, qr/two/, 'ls project:A priority:H --> !two');
|
||||
unlike ($output, qr/three/, 'ls project:A priority:H --> !three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project:A and priority:H 2>&1};
|
||||
like ($output, qr/one/, 'ls project:A priority:H --> one');
|
||||
unlike ($output, qr/two/, 'ls project:A priority:H --> !two');
|
||||
unlike ($output, qr/three/, 'ls project:A priority:H --> !three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project:A and priority.not:H 2>&1};
|
||||
unlike ($output, qr/one/, 'ls project:A priority:H --> !one');
|
||||
like ($output, qr/two/, 'ls project:A priority:H --> two');
|
||||
unlike ($output, qr/three/, 'ls project:A priority:H --> !three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project=A priority=H 2>&1};
|
||||
like ($output, qr/one/, 'ls project:A priority:H --> one');
|
||||
unlike ($output, qr/two/, 'ls project:A priority:H --> !two');
|
||||
unlike ($output, qr/three/, 'ls project:A priority:H --> !three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project=A and priority=H 2>&1};
|
||||
like ($output, qr/one/, 'ls project:A priority:H --> one');
|
||||
unlike ($output, qr/two/, 'ls project:A priority:H --> !two');
|
||||
unlike ($output, qr/three/, 'ls project:A priority:H --> !three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project=A and priority!=H 2>&1};
|
||||
unlike ($output, qr/one/, 'ls project:A priority:H --> !one');
|
||||
like ($output, qr/two/, 'ls project:A priority:H --> two');
|
||||
unlike ($output, qr/three/, 'ls project:A priority:H --> !three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data op.rc);
|
||||
exit 0;
|
||||
|
90
test/op_gt.t
90
test/op_gt.t
|
@ -1,90 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 24;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'op.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:op.rc add one due:yesterday priority:H 2>&1};
|
||||
qx{../src/task rc:op.rc add two due:tomorrow priority:M 2>&1};
|
||||
qx{../src/task rc:op.rc add three priority:L 2>&1};
|
||||
qx{../src/task rc:op.rc add four 2>&1};
|
||||
|
||||
# Test the '>' operator.
|
||||
my $output = qx{../src/task rc:op.rc ls due.after:today 2>&1};
|
||||
unlike ($output, qr/one/, 'ls due.after:today --> !one');
|
||||
like ($output, qr/two/, 'ls due.after:today --> two');
|
||||
unlike ($output, qr/three/, 'ls due.after:today --> !three');
|
||||
unlike ($output, qr/four/, 'ls due.after:today --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls 'due > today' 2>&1};
|
||||
unlike ($output, qr/one/, 'ls due > today --> !one');
|
||||
like ($output, qr/two/, 'ls due > today --> two');
|
||||
unlike ($output, qr/three/, 'ls due > today --> !three');
|
||||
unlike ($output, qr/four/, 'ls due > today --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls priority.above:L 2>&1};
|
||||
like ($output, qr/one/, 'ls priority.above:L --> one');
|
||||
like ($output, qr/two/, 'ls priority.above:L --> two');
|
||||
unlike ($output, qr/three/, 'ls priority.above:L --> !three');
|
||||
unlike ($output, qr/four/, 'ls priority.above:L --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls 'priority > L' 2>&1};
|
||||
like ($output, qr/one/, 'ls priority > L --> one');
|
||||
like ($output, qr/two/, 'ls priority > L --> two');
|
||||
unlike ($output, qr/three/, 'ls priority > L --> !three');
|
||||
unlike ($output, qr/four/, 'ls priority > L --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls 'description > t' 2>&1};
|
||||
unlike ($output, qr/one/, 'ls description > t --> !one');
|
||||
like ($output, qr/two/, 'ls description > t --> two');
|
||||
like ($output, qr/three/, 'ls description > t --> three');
|
||||
unlike ($output, qr/four/, 'ls description > t --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc 'urgency > 10.0' ls 2>&1};
|
||||
like ($output, qr/one/, 'ls urgency > 10 --> one');
|
||||
like ($output, qr/two/, 'ls urgency > 10 --> two');
|
||||
unlike ($output, qr/three/, 'ls urgency > 10 --> !three');
|
||||
unlike ($output, qr/four/, 'ls urgency > 10 --> !four');
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data op.rc);
|
||||
exit 0;
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 12;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'op.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:op.rc add one priority:H 2>&1};
|
||||
qx{../src/task rc:op.rc add two priority:M 2>&1};
|
||||
qx{../src/task rc:op.rc add three priority:L 2>&1};
|
||||
qx{../src/task rc:op.rc add four 2>&1};
|
||||
|
||||
# Test the '>=' operator.
|
||||
my $output = qx{../src/task rc:op.rc ls 'priority >= M' 2>&1};
|
||||
like ($output, qr/one/, 'ls priority >= M --> one');
|
||||
like ($output, qr/two/, 'ls priority >= M --> two');
|
||||
unlike ($output, qr/three/, 'ls priority >= M --> !three');
|
||||
unlike ($output, qr/four/, 'ls priority >= M --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls 'description >= t' 2>&1};
|
||||
unlike ($output, qr/one/, 'ls description >= t --> !one');
|
||||
like ($output, qr/two/, 'ls description >= t --> two');
|
||||
like ($output, qr/three/, 'ls description >= t --> three');
|
||||
unlike ($output, qr/four/, 'ls description >= t --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc 'urgency >= 2.0' ls 2>&1};
|
||||
like ($output, qr/one/, 'ls urgency >= 2.0 --> one');
|
||||
like ($output, qr/two/, 'ls urgency >= 2.0 --> two');
|
||||
unlike ($output, qr/three/, 'ls urgency >= 2.0 --> !three');
|
||||
unlike ($output, qr/four/, 'ls urgency >= 2.0 --> !four');
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data op.rc);
|
||||
exit 0;
|
||||
|
94
test/op_lt.t
94
test/op_lt.t
|
@ -1,94 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 24;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
use File::Basename;
|
||||
my $ut = basename ($0);
|
||||
my $rc = $ut . '.rc';
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', $rc)
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:$rc add one due:yesterday priority:H 2>&1};
|
||||
qx{../src/task rc:$rc add two due:tomorrow priority:M 2>&1};
|
||||
qx{../src/task rc:$rc add three priority:L 2>&1};
|
||||
qx{../src/task rc:$rc add four 2>&1};
|
||||
|
||||
# Test the '<' operator.
|
||||
my $output = qx{../src/task rc:$rc ls due.before:today 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls due.before:today --> one");
|
||||
unlike ($output, qr/two/, "$ut: ls due.before:today --> !two");
|
||||
unlike ($output, qr/three/, "$ut: ls due.before:today --> !three");
|
||||
unlike ($output, qr/four/, "$ut: ls due.before:today --> !four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls 'due < today' 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls due < today --> one");
|
||||
unlike ($output, qr/two/, "$ut: ls due < today --> !two");
|
||||
unlike ($output, qr/three/, "$ut: ls due < today --> !three");
|
||||
unlike ($output, qr/four/, "$ut: ls due < today --> !four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls priority.below:H 2>&1};
|
||||
unlike ($output, qr/one/, "$ut: ls priority.below:H --> !one");
|
||||
like ($output, qr/two/, "$ut: ls priority.below:H --> two");
|
||||
like ($output, qr/three/, "$ut: ls priority.below:H --> three");
|
||||
like ($output, qr/four/, "$ut: ls priority.below:H --> four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls 'priority < H' 2>&1};
|
||||
unlike ($output, qr/one/, "$ut: ls priority < H --> !one");
|
||||
like ($output, qr/two/, "$ut: ls priority < H --> two");
|
||||
like ($output, qr/three/, "$ut: ls priority < H --> three");
|
||||
like ($output, qr/four/, "$ut: ls priority < H --> four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls 'description < t' 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls description < t --> one");
|
||||
unlike ($output, qr/two/, "$ut: ls description < t --> !two");
|
||||
unlike ($output, qr/three/, "$ut: ls description < t --> !three");
|
||||
like ($output, qr/four/, "$ut: ls description < t --> four");
|
||||
|
||||
$output = qx{../src/task rc:$rc 'urgency < 10.0' ls 2>&1};
|
||||
unlike ($output, qr/one/, "$ut: ls description < 10 --> !one");
|
||||
unlike ($output, qr/two/, "$ut: ls description < 10 --> !two");
|
||||
like ($output, qr/three/, "$ut: ls description < 10 --> three");
|
||||
like ($output, qr/four/, "$ut: ls description < 10 --> four");
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||
exit 0;
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 12;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
use File::Basename;
|
||||
my $ut = basename ($0);
|
||||
my $rc = $ut . '.rc';
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', $rc)
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:$rc add one priority:H 2>&1};
|
||||
qx{../src/task rc:$rc add two priority:M 2>&1};
|
||||
qx{../src/task rc:$rc add three priority:L 2>&1};
|
||||
qx{../src/task rc:$rc add four 2>&1};
|
||||
|
||||
# Test the '<=' operator.
|
||||
my $output = qx{../src/task rc:$rc ls 'priority <= M' 2>&1};
|
||||
unlike ($output, qr/one/, "$ut: ls priority <= H --> !one");
|
||||
like ($output, qr/two/, "$ut: ls priority <= H --> two");
|
||||
like ($output, qr/three/, "$ut: ls priority <= H --> three");
|
||||
like ($output, qr/four/, "$ut: ls priority <= H --> four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls 'description <= t' 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls description <= t --> one");
|
||||
unlike ($output, qr/two/, "$ut: ls description <= t --> !two");
|
||||
unlike ($output, qr/three/, "$ut: ls description <= t --> !three");
|
||||
like ($output, qr/four/, "$ut: ls description <= t --> four");
|
||||
|
||||
$output = qx{../src/task rc:$rc 'urgency <= 2.0' ls 2>&1};
|
||||
unlike ($output, qr/one/, "$ut: ls urgency <= 2.0 --> !one");
|
||||
unlike ($output, qr/two/, "$ut: ls urgency <= 2.0 --> !two");
|
||||
like ($output, qr/three/, "$ut: ls urgency <= 2.0 --> three");
|
||||
like ($output, qr/four/, "$ut: ls urgency <= 2.0 --> four");
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||
exit 0;
|
||||
|
82
test/op_or.t
82
test/op_or.t
|
@ -1,82 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 16;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
use File::Basename;
|
||||
my $ut = basename ($0);
|
||||
my $rc = $ut . '.rc';
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', $rc)
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:$rc add one project:A priority:H 2>&1};
|
||||
qx{../src/task rc:$rc add two project:A 2>&1};
|
||||
qx{../src/task rc:$rc add three priority:H 2>&1};
|
||||
qx{../src/task rc:$rc add four 2>&1};
|
||||
|
||||
# Test the 'or' operator.
|
||||
my $output = qx{../src/task rc:$rc ls project:A or priority:H 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls project:A or priority:H --> one");
|
||||
like ($output, qr/two/, "$ut: ls project:A or priority:H --> two");
|
||||
like ($output, qr/three/, "$ut: ls project:A or priority:H --> three");
|
||||
unlike ($output, qr/four/, "$ut: ls project:A or priority:H --> !four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls project:A or priority=H 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls project:A or priority=H --> one");
|
||||
like ($output, qr/two/, "$ut: ls project:A or priority=H --> two");
|
||||
like ($output, qr/three/, "$ut: ls project:A or priority=H --> three");
|
||||
unlike ($output, qr/four/, "$ut: ls project:A or priority=H --> !four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls project=A or priority:H 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls project=A or priority:H --> one");
|
||||
like ($output, qr/two/, "$ut: ls project=A or priority:H --> two");
|
||||
like ($output, qr/three/, "$ut: ls project=A or priority:H --> three");
|
||||
unlike ($output, qr/four/, "$ut: ls project=A or priority:H --> !four");
|
||||
|
||||
$output = qx{../src/task rc:$rc ls project=A or priority=H 2>&1};
|
||||
like ($output, qr/one/, "$ut: ls project=A or priority=H --> one");
|
||||
like ($output, qr/two/, "$ut: ls project=A or priority=H --> two");
|
||||
like ($output, qr/three/, "$ut: ls project=A or priority=H --> three");
|
||||
unlike ($output, qr/four/, "$ut: ls project=A or priority=H --> !four");
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||
exit 0;
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 16;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'op.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:op.rc add one project:A priority:H 2>&1};
|
||||
qx{../src/task rc:op.rc add two project:A 2>&1};
|
||||
qx{../src/task rc:op.rc add three priority:H 2>&1};
|
||||
qx{../src/task rc:op.rc add four 2>&1};
|
||||
|
||||
# Test the 'xor' operator.
|
||||
my $output = qx{../src/task rc:op.rc ls project:A xor priority:H 2>&1};
|
||||
unlike ($output, qr/one/, 'ls project:A priority:H --> !one');
|
||||
like ($output, qr/two/, 'ls project:A priority:H --> two');
|
||||
like ($output, qr/three/, 'ls project:A priority:H --> three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project:A xor priority=H 2>&1};
|
||||
unlike ($output, qr/one/, 'ls project:A priority=H --> !one');
|
||||
like ($output, qr/two/, 'ls project:A priority=H --> two');
|
||||
like ($output, qr/three/, 'ls project:A priority=H --> three');
|
||||
unlike ($output, qr/four/, 'ls project:A priority=H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project=A xor priority:H 2>&1};
|
||||
unlike ($output, qr/one/, 'ls project=A priority:H --> !one');
|
||||
like ($output, qr/two/, 'ls project=A priority:H --> two');
|
||||
like ($output, qr/three/, 'ls project=A priority:H --> three');
|
||||
unlike ($output, qr/four/, 'ls project=A priority:H --> !four');
|
||||
|
||||
$output = qx{../src/task rc:op.rc ls project=A xor priority=H 2>&1};
|
||||
unlike ($output, qr/one/, 'ls project=A priority=H --> !one');
|
||||
like ($output, qr/two/, 'ls project=A priority=H --> two');
|
||||
like ($output, qr/three/, 'ls project=A priority=H --> three');
|
||||
unlike ($output, qr/four/, 'ls project=A priority=H --> !four');
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data op.rc);
|
||||
exit 0;
|
||||
|
427
test/operators.t
Executable file
427
test/operators.t
Executable file
|
@ -0,0 +1,427 @@
|
|||
#!/usr/bin/env python2.7
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright 2006 - 2015, Paul Beckingham, Federico Hernandez.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# http://www.opensource.org/licenses/mit-license.php
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
import sys
|
||||
import os
|
||||
import unittest
|
||||
# Ensure python finds the local simpletap module
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from basetest import Task, TestCase
|
||||
|
||||
|
||||
class TestOperatorsIdentity(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.t = Task()
|
||||
|
||||
cls.t(("add", "one", "project:A", "priority:H"))
|
||||
cls.t(("add", "two", "project:A"))
|
||||
cls.t(("add", "three", "priority:H"))
|
||||
cls.t(("add", "four"))
|
||||
|
||||
# AND operator #
|
||||
|
||||
def test_implicit_and(self):
|
||||
"""operator implicit and :"""
|
||||
code, out, err = self.t(("ls", "project:A", "priority:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_explicit_and(self):
|
||||
"""operator explicit and :"""
|
||||
code, out, err = self.t(("ls", "project:A", "and", "priority:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_and_not(self):
|
||||
"""operator and + not :"""
|
||||
code, out, err = self.t(("ls", "project:A", "and", "priority.not:H"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_implicit_and_equal(self):
|
||||
"""operator implicit and ="""
|
||||
code, out, err = self.t(("ls", "project:A", "priority:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_explicit_and_equal(self):
|
||||
"""operator explicit and ="""
|
||||
code, out, err = self.t(("ls", "project:A", "and", "priority:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_and_not_equal(self):
|
||||
"""operator and + not ="""
|
||||
code, out, err = self.t(("ls", "project:A", "and", "priority.not:H"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
# OR operator #
|
||||
|
||||
def test_colon_or_colon(self):
|
||||
"""operator : or :"""
|
||||
code, out, err = self.t(("ls", "project:A", "or", "priority:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_colon_or_equal(self):
|
||||
"""operator : or ="""
|
||||
code, out, err = self.t(("ls", "project:A", "or", "priority=H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_equal_or_colon(self):
|
||||
"""operator = or :"""
|
||||
code, out, err = self.t(("ls", "project=A", "or", "priority:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_equal_or_equal(self):
|
||||
"""operator = or ="""
|
||||
code, out, err = self.t(("ls", "project=A", "or", "priority=H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_colon_or_not_colon(self):
|
||||
"""operator : or not :"""
|
||||
code, out, err = self.t(("ls", "project:A", "or", "priority.not:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
|
||||
# XOR operator #
|
||||
|
||||
def test_colon_xor_colon(self):
|
||||
"""operator : xor :"""
|
||||
code, out, err = self.t(("ls", "project:A", "xor", "priority:H"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_colon_xor_equal(self):
|
||||
"""operator : xor ="""
|
||||
code, out, err = self.t(("ls", "project:A", "xor", "priority=H"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_equal_xor_colon(self):
|
||||
"""operator = xor :"""
|
||||
code, out, err = self.t(("ls", "project=A", "xor", "priority:H"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_equal_xor_equal(self):
|
||||
"""operator = xor ="""
|
||||
code, out, err = self.t(("ls", "project=A", "xor", "priority=H"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
|
||||
def test_colon_xor_not_colon(self):
|
||||
"""operator : xor not :"""
|
||||
code, out, err = self.t(("ls", "project:A", "xor", "priority.not:H"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
|
||||
|
||||
class TestOperatorsQuantity(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.t = Task()
|
||||
|
||||
cls.t(("add", "one", "due:yesterday", "priority:H"))
|
||||
cls.t(("add", "two", "due:tomorrow", "priority:M"))
|
||||
cls.t(("add", "three", "priority:L"))
|
||||
cls.t(("add", "four"))
|
||||
cls.t(("add", "five", "due:today"))
|
||||
|
||||
# > operator #
|
||||
|
||||
def test_due_after(self):
|
||||
"""operator due.after:today"""
|
||||
code, out, err = self.t(("ls", "due.after:today"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_due_greater(self):
|
||||
"""operator due > today"""
|
||||
code, out, err = self.t(("ls", "due > today"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_priority_above(self):
|
||||
"""operator priority.above:M"""
|
||||
code, out, err = self.t(("ls", "priority.above:M"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_priority_greater(self):
|
||||
"""operator priority > M"""
|
||||
code, out, err = self.t(("ls", "priority > M"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_description_greater(self):
|
||||
"""operator description > o"""
|
||||
code, out, err = self.t(("ls", "description > o"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_urgency_greater(self):
|
||||
"""operator urgency > 10.0"""
|
||||
code, out, err = self.t(("ls", "urgency > 10.0"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
# < operator #
|
||||
|
||||
def test_due_before(self):
|
||||
"""operator due.before:today"""
|
||||
code, out, err = self.t(("ls", "due.before:today"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_due_smaller(self):
|
||||
"""operator due < today"""
|
||||
code, out, err = self.t(("ls", "due < today"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_priority_below(self):
|
||||
"""operator priority.below:M"""
|
||||
code, out, err = self.t(("ls", "priority.below:M"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_priority_smaller(self):
|
||||
"""operator priority < M"""
|
||||
code, out, err = self.t(("ls", "priority < M"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_description_smaller(self):
|
||||
"""operator description < o"""
|
||||
code, out, err = self.t(("ls", "description < o"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_urgency_smaller(self):
|
||||
"""operator urgency < 10.0"""
|
||||
code, out, err = self.t(("ls", "urgency < 10.0"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
# >= operator #
|
||||
|
||||
def test_due_greater_equal(self):
|
||||
"""operator due >= today"""
|
||||
code, out, err = self.t(("ls", "due >= today"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_priority_greater_equal(self):
|
||||
"""operator priority >= M"""
|
||||
code, out, err = self.t(("ls", "priority >= M"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_description_greater_equal(self):
|
||||
"""operator description >= o"""
|
||||
code, out, err = self.t(("ls", "description >= o"))
|
||||
|
||||
# NOTE >= is > + ==, not > + =
|
||||
# a single = is a partial match, check: task calc 'a = aa' vs 'a == aa'
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
def test_urgency_greater_equal(self):
|
||||
"""operator urgency >= 10.0"""
|
||||
code, out, err = self.t(("ls", "urgency >= 10.0"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertNotIn("five", out)
|
||||
|
||||
# <= operator #
|
||||
|
||||
def test_due_smaller_equal(self):
|
||||
"""operator due <= today"""
|
||||
code, out, err = self.t(("ls", "due <= today"))
|
||||
|
||||
self.assertIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertNotIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_priority_smaller_equal(self):
|
||||
"""operator priority <= M"""
|
||||
code, out, err = self.t(("ls", "priority <= M"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_description_smaller_equal(self):
|
||||
"""operator description <= o"""
|
||||
code, out, err = self.t(("ls", "description <= o"))
|
||||
|
||||
# NOTE <= is < + ==, not < + =
|
||||
# a single = is a partial match, check: task calc 'a = aa' vs 'a == aa'
|
||||
self.assertNotIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertNotIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
def test_urgency_smaller_equal(self):
|
||||
"""operator urgency <= 10.0"""
|
||||
code, out, err = self.t(("ls", "urgency <= 10.0"))
|
||||
|
||||
self.assertNotIn("one", out)
|
||||
self.assertNotIn("two", out)
|
||||
self.assertIn("three", out)
|
||||
self.assertIn("four", out)
|
||||
self.assertIn("five", out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from simpletap import TAPTestRunner
|
||||
unittest.main(testRunner=TAPTestRunner())
|
||||
|
||||
# vim: ai sts=4 et sw=4
|
Loading…
Add table
Add a link
Reference in a new issue