Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 17184 Details for
Bug 11668
Add emacs-style "Alt-/" hippie auto completion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
tests patch
HippieCompletion-tests-2005-01-14.diff (text/plain), 9.89 KB, created by
Genady Beryozkin
on 2005-01-14 17:55:54 EST
(
hide
)
Description:
tests patch
Filename:
MIME Type:
Creator:
Genady Beryozkin
Created:
2005-01-14 17:55:54 EST
Size:
9.89 KB
patch
obsolete
>Index: src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java,v >retrieving revision 1.6 >diff -u -r1.6 WorkbenchTextEditorTestSuite.java >--- src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java 4 Oct 2004 12:42:42 -0000 1.6 >+++ src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java 14 Jan 2005 22:42:20 -0000 >@@ -27,6 +27,7 @@ > //$JUnit-BEGIN$ > suite.addTest(DiffTestSuite.suite()); > suite.addTest(FindReplaceDialogTest.suite()); >+ suite.addTest(HippieCompletionTest.suite()); > //$JUnit-END$ > return suite; > } >Index: .settings/org.eclipse.core.resources.prefs >=================================================================== >RCS file: .settings/org.eclipse.core.resources.prefs >diff -N .settings/org.eclipse.core.resources.prefs >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .settings/org.eclipse.core.resources.prefs 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+#Fri Jan 14 17:26:55 IST 2005 >+eclipse.preferences.version=1 >+encoding//src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java=Cp1255 >Index: src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java >=================================================================== >RCS file: src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java >diff -N src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,178 @@ >+package org.eclipse.ui.workbench.texteditor.tests; >+ >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.List; >+ >+import junit.framework.Test; >+import junit.framework.TestCase; >+import junit.framework.TestSuite; >+ >+import org.eclipse.jface.text.BadLocationException; >+import org.eclipse.jface.text.Document; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.ui.texteditor.HippieCompleteAction; >+ >+/** >+ * Tests for the Hippie completion action of the text editor >+ * >+ * @author Genady Beryozkin, me@genady.org >+ */ >+public class HippieCompletionTest extends TestCase { >+ >+ IDocument[] documents; >+ >+ public HippieCompletionTest(String name) { >+ super(name); >+ } >+ >+ /* (non-Javadoc) >+ * @see junit.framework.TestCase#setUp() >+ */ >+ protected void setUp() throws Exception { >+ documents = new IDocument[4]; >+ documents[0] = new Document("package ui.TestPackage;\n" + >+ "\n" + >+ "/**\n" + >+ " * This is a testing class that tests the hippie completion engine.\n" + >+ " * it has a simple main with a print method\n" + >+ " */\n" + >+ "public class TestClass1 {\n" + >+ "\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(\"I will be printing Hello world!\");\n" + >+ " }\n" + >+ "}"); >+ documents[1] = new Document("This is a simple text file\n" + >+ "that is also used in the completion engine tests"); >+ >+ documents[2] = new Document("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<plugin\n" + >+ " id=\"org.eclipse.ui.workbench.texteditor.tests\"\n" + >+ " name=\"%Plugin.name\"\n" + >+ " version=\"3.1.0\"\n" + >+ " provider-name=\"%Plugin.providerName\">\n" + >+ "\n" + >+ " <runtime>\n" + >+ " <library name=\"workbenchtexteditortests.jar\">\n" + >+ " <export name=\"*\"/>\n" + >+ " </library>\n" + >+ " </runtime>\n" + >+ " \n" + >+ " <requires>\n" + >+ " <import plugin=\"org.eclipse.core.runtime.compatibility\"/>\n" + >+ " <import plugin=\"org.junit\"/>\n" + >+ " <import plugin=\"org.eclipse.text.tests\"/>\n" + >+ " <import plugin=\"org.eclipse.jface.text\"/>\n" + >+ " <import plugin=\"org.eclipse.ui.workbench.texteditor\"/>\n" + >+ " <import plugin=\"org.eclipse.ui\"/>\n" + >+ " </requires>\n" + >+ " \n" + >+ "</plugin>\n" + >+ ""); >+ >+ documents[3] = new Document("###############################################################################\n" + >+ "# Copyright (c) 2000, 2004 IBM Corporation and others.\n" + >+ "# All rights reserved. This program and the accompanying materials \n" + >+ "# are made available under the terms of the Common Public License v1.0\n" + >+ "# which accompanies this distribution, and is available at\n" + >+ "# http://www.eclipse.org/legal/cpl-v10.html\n" + >+ "# \n" + >+ "# Contributors:\n" + >+ "# IBM Corporation - initial API and implementation\n" + >+ "###############################################################################\n" + >+ "bin.includes = plugin.xml,\\\n" + >+ " plugin.properties,\\\n" + >+ " test.xml,\\\n" + >+ " about.html,\\\n" + >+ " *.jar\n" + >+ "\n" + >+ "src.includes = about.html\n" + >+ " \n" + >+ "source.workbenchtexteditortests.jar = src/\n" + >+ ""); >+ } >+ >+ public void testSearchBackwards1() { >+ try { >+ ArrayList list = HippieCompleteAction.getBackwardsSuggestions(documents[0], >+ "pri", documents[0].get().indexOf("println") + 10); >+ assertEquals(list.size(), 2); >+ assertEquals(list.get(0), "ntln"); >+ assertEquals(list.get(1), "nt"); >+ >+ list = HippieCompleteAction.getBackwardsSuggestions(documents[0], >+ "pri", documents[0].getLength() - 1); >+ assertEquals(list.size(), 3); >+ assertEquals(list.get(0), "nting"); >+ assertEquals(list.get(1), "ntln"); >+ assertEquals(list.get(2), "nt"); >+ >+ list = HippieCompleteAction.getBackwardsSuggestions(documents[0], >+ "pri", documents[0].get().indexOf("println") + 1); >+ assertEquals(list.size(), 1); >+ assertEquals(list.get(0), "nt"); >+ >+ } catch (BadLocationException e) { >+ assertTrue("Got out of document bounds", false); >+ } >+ } >+ >+ public void testSearchBackwards2() { >+ try { >+ ArrayList list = HippieCompleteAction.getBackwardsSuggestions(documents[2], >+ "plugi", documents[2].getLength() - 1); >+ assertEquals(8, list.size()); >+ list = HippieCompleteAction.getUnique(list); >+ assertEquals(1, list.size()); >+ assertEquals("n", list.get(0)); >+ >+ list = HippieCompleteAction.getBackwardsSuggestions(documents[2], >+ "plugin", documents[2].getLength() - 1); >+ assertEquals(0, list.size()); // empty completions discarded >+ >+ } catch (BadLocationException e) { >+ assertTrue("Got out of document bounds", false); >+ } >+ } >+ >+ public void testSearch() { >+ ArrayList docsList = new ArrayList(Arrays.asList(this.documents)); >+ List result = HippieCompleteAction.createSuggestions("te", docsList); >+ assertEquals("Number of completions does not match", 12, result.size()); >+ result = HippieCompleteAction.getUnique(result); >+ assertEquals("Number of completions does not match", 6, result.size()); >+ >+ result = HippieCompleteAction.createSuggestions("Plug", docsList); >+ assertEquals("Number of completions does not match", 2, result.size()); >+ >+ result = HippieCompleteAction.createSuggestions("p", docsList); >+ assertEquals("Number of completions does not match", 20, result.size()); >+ result = HippieCompleteAction.getUnique(result); >+ assertEquals("Number of completions does not match", 10, result.size()); >+ assertEquals("Incorrect completion", "ackage", result.get(0)); >+ assertEquals("Incorrect completion", "rint", result.get(1)); >+ assertEquals("Incorrect completion", "ublic", result.get(2)); >+ assertEquals("Incorrect completion", "rintln", result.get(3)); >+ assertEquals("Incorrect completion", "rinting", result.get(4)); >+ assertEquals("Incorrect completion", "lugin", result.get(5)); >+ assertEquals("Incorrect completion", "rovider", result.get(6)); >+ assertEquals("Incorrect completion", "roviderName", result.get(7)); >+ assertEquals("Incorrect completion", "rogram", result.get(8)); >+ assertEquals("Incorrect completion", "roperties", result.get(9)); >+ } >+ >+ public void testSearch2() { >+ ArrayList docsList = new ArrayList(Arrays.asList(this.documents)); >+ List result = HippieCompleteAction.createSuggestions("printe", docsList); >+ assertEquals("Number of completions does not match", 0, result.size()); >+ >+ result = HippieCompleteAction.createSuggestions("s", docsList); >+ assertEquals("Number of completions does not match", 6, result.size()); >+ } >+ >+ public static Test suite() { >+ return new TestSuite(HippieCompletionTest.class); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 11668
:
806
|
14942
|
17032
|
17127
|
17183
|
17184
|
17243
|
17310