diff options
author | David Green | 2012-03-28 01:31:09 +0000 |
---|---|---|
committer | David Green | 2012-03-28 01:31:09 +0000 |
commit | 43f40222dec942302ca00f8295f3166c2a9706b9 (patch) | |
tree | ae0a715c816264ec32c25dd9bf24cd3ee73ec2ee /org.eclipse.mylyn.tasks.index.tests | |
parent | 2d50aaa6ef751e881182be166de5b408167a8e90 (diff) | |
download | org.eclipse.mylyn.tasks-43f40222dec942302ca00f8295f3166c2a9706b9.tar.gz org.eclipse.mylyn.tasks-43f40222dec942302ca00f8295f3166c2a9706b9.tar.xz org.eclipse.mylyn.tasks-43f40222dec942302ca00f8295f3166c2a9706b9.zip |
bug 375363: update user guide to include more information about task list filtering
https://bugs.eclipse.org/bugs/show_bug.cgi?id=375363
add tests to confirm expected behaviour
Diffstat (limited to 'org.eclipse.mylyn.tasks.index.tests')
-rw-r--r-- | org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java b/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java index dfe671b9e..2453801df 100644 --- a/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java +++ b/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; @@ -228,6 +229,41 @@ public class TaskListIndexTest extends AbstractTaskListIndexTest { } @Test + public void testMatchesSummaryWithExpectedQueryBehaviour() throws InterruptedException { + setupIndex(); + + ITask task = context.createLocalTask(); + task.setSummary("one two three"); + + context.getTaskList().notifyElementsChanged(Collections.singleton(task)); + + index.waitUntilIdle(); + + index.setDefaultField(FIELD_SUMMARY); + + // default search (without logical operators) should behave as a prefix search + assertTrue(index.matches(task, "one")); + assertTrue(index.matches(task, "two")); + assertTrue(index.matches(task, "three")); + assertTrue(index.matches(task, "thr")); + assertFalse(index.matches(task, "one three")); + + // wildcard search should not match multiple terms separated by whitespace + assertFalse(index.matches(task, "one*three")); + + // wildcard search should match multiple characters in a single term + assertTrue(index.matches(task, "t*ee")); + + // logical operator makes it work with multiple terms + assertTrue(index.matches(task, "one AND three")); + assertTrue(index.matches(task, "one OR three")); + assertTrue(index.matches(task, "one AND thr")); + + // logical operator requiring a non-existant term should not match + assertFalse(index.matches(task, "one AND four")); + } + + @Test public void testCharacterEscaping() { setupIndex(); for (String special : new String[] { "+", "-", "&&", "||", "!", "(", ")", "{", "}", "[", "]", "^", "\"", "~", |