Tests: Merge bug.299 with project.t and add more scenarios
* Currently one of the new scenarios fails. Looks like a bug.
This commit is contained in:
@@ -1,63 +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 => 3;
|
||||
|
||||
# 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 three unique tasks with different project names.
|
||||
qx{../src/task rc:$rc add project:one foo 2>&1};
|
||||
qx{../src/task rc:$rc add project:two bar 2>&1};
|
||||
qx{../src/task rc:$rc add project:three baz 2>&1};
|
||||
|
||||
# Result: Run list but exclude two of the three projects names using
|
||||
# project.hasnt:<name>
|
||||
my $output = qx{../src/task rc:$rc list project.isnt:one project.isnt:two 2>&1};
|
||||
unlike ($output, qr/one.*foo/ms, "$ut: project.isnt:one project.isnt:two - no foo");
|
||||
unlike ($output, qr/two.*bar/ms, "$ut: project.isnt:one project.isnt:two - no bar");
|
||||
like ($output, qr/three.*baz/ms, "$ut: project.isnt:one project.isnt:two - yes baz");
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||
exit 0;
|
||||
|
||||
@@ -153,6 +153,47 @@ class TestProjects(TestCase):
|
||||
self.validate_indentation(out)
|
||||
|
||||
|
||||
class TestBug299(TestCase):
|
||||
def setUp(self):
|
||||
self.t = Task()
|
||||
self.t(("add", "project:one", "foo"))
|
||||
self.t(("add", "project:ones", "faz"))
|
||||
self.t(("add", "project:phone", "boo"))
|
||||
self.t(("add", "project:bones", "too"))
|
||||
self.t(("add", "project:two", "bar"))
|
||||
self.t(("add", "project:three", "baz"))
|
||||
|
||||
def test_project_exclusion_isnt(self):
|
||||
"""check project exclusion using project.isnt:<name>
|
||||
|
||||
Reported in bug 299
|
||||
"""
|
||||
code, out, err = self.t(("list", "project.isnt:one", "pro.isnt:two"))
|
||||
|
||||
self.assertNotRegexpMatches(out, "one.*foo")
|
||||
self.assertRegexpMatches(out, "ones.*faz")
|
||||
self.assertRegexpMatches(out, "phone.*boo")
|
||||
self.assertRegexpMatches(out, "bones.*too")
|
||||
|
||||
self.assertNotRegexpMatches(out, "two.*bar")
|
||||
self.assertRegexpMatches(out, "three.*baz")
|
||||
|
||||
def test_project_exclusion_hasnt(self):
|
||||
"""check project exclusion using project.hasnt:<name>
|
||||
|
||||
Reported in bug 299
|
||||
"""
|
||||
code, out, err = self.t(("list", "project.hasnt:one", "pro.hasnt:two"))
|
||||
|
||||
self.assertNotRegexpMatches(out, "one.*foo")
|
||||
self.assertNotRegexpMatches(out, "ones.*faz")
|
||||
self.assertNotRegexpMatches(out, "phone.*boo")
|
||||
self.assertNotRegexpMatches(out, "bones.*too")
|
||||
|
||||
self.assertNotRegexpMatches(out, "two.*bar")
|
||||
self.assertRegexpMatches(out, "three.*baz")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from simpletap import TAPTestRunner
|
||||
unittest.main(testRunner=TAPTestRunner())
|
||||
|
||||
Reference in New Issue
Block a user