Commit b0eab341 authored by Bram Schoenmakers's avatar Bram Schoenmakers

When -x is given, do not add the LimitFilter.

parent c20b2ef2
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import Config
import CommandTest
import ListCommand
import TestFacilities
......@@ -94,6 +95,32 @@ class ListCommandTest(CommandTest.CommandTest):
self.assertEquals(self.output, " 2 (D) Bar @Context1 +Project2 p:1\n")
self.assertEquals(self.errors, "")
def test_list11(self):
old_limit = Config.LIST_LIMIT
Config.LIST_LIMIT = 1
command = ListCommand.ListCommand(["project"], self.todolist, self.out, self.errors)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n")
self.assertEquals(self.errors, "")
Config.LIST_LIMIT = old_limit
def test_list12(self):
old_limit = Config.LIST_LIMIT
Config.LIST_LIMIT = 1
command = ListCommand.ListCommand(["-x", "project"], self.todolist, self.out, self.errors)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n 3 (C) Baz @Context1 +Project1 key:value id:1\n 2 (D) Bar @Context1 +Project2 p:1\n")
self.assertEquals(self.errors, "")
Config.LIST_LIMIT = old_limit
def test_help(self):
command = ListCommand.ListCommand(["help"], self.todolist, self.out, self.error)
command.execute()
......
......@@ -59,7 +59,9 @@ class ListCommand(Command.Command):
filters.append(Filter.RelevanceFilter())
grep_filters()
filters.append(Filter.LimitFilter(Config.LIST_LIMIT))
if not self.show_all:
filters.append(Filter.LimitFilter(Config.LIST_LIMIT))
return filters
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment