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 63339 Details for
Bug 181236
Write tests for new editor functionality (folding, hover, completion)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
RpmMacroProposalsList and RpmPackageProposalsList test
plugin-testcase.patch (text/plain), 6.38 KB, created by
Alphonse Van Assche
on 2007-04-10 07:28:01 EDT
(
hide
)
Description:
RpmMacroProposalsList and RpmPackageProposalsList test
Filename:
MIME Type:
Creator:
Alphonse Van Assche
Created:
2007-04-10 07:28:01 EDT
Size:
6.38 KB
patch
obsolete
>Index: src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTests.java >=================================================================== >--- src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTests.java (révision 0) >+++ src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmMacroProposalsListTests.java (révision 0) >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Alphonse Van Assche. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Alphonse Van Assche - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.linuxtools.rpm.ui.editor.tests; >+ >+import java.util.Map; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.linuxtools.rpm.ui.editor.RpmMacroProposalsList; >+ >+public class RpmMacroProposalsListTests extends TestCase { >+ >+ RpmMacroProposalsList macroProposalsList; >+ >+ public RpmMacroProposalsListTests(String name) { >+ super(name); >+ } >+ >+ protected void setUp() throws Exception { >+ macroProposalsList = new RpmMacroProposalsList(); >+ } >+ >+ public final void testBuildMacroList() { >+ macroProposalsList.buildMacroList(); >+ if (!macroProposalsList.findKey("%_libdir")) >+ fail("buildMacroList faild, %_libdir macro was not found!"); >+ } >+ >+ public final void testGetProposals() { >+ Map proposals = macroProposalsList.getProposals("%_libdir"); >+ if (proposals.size() != 1) { >+ fail("getProposals faild, %_libdir macro was retrive as proposals"); >+ } >+ } >+ >+ public final void testGetProposals2() { >+ Map proposals = macroProposalsList.getProposals("%_unexistingmacro"); >+ if (proposals.size() != 0) { >+ fail("getProposals faild, %_unexistingmacro don't can exist"); >+ } >+ } >+ >+ public final void testGetValue() { >+ if (!macroProposalsList.getValue("_libdir").contains("lib")) { >+ fail("getValue faild, %_libdir value don't end with '%{_lib}'"); >+ } >+ } >+ >+ public final void testGetValue2() { >+ if (macroProposalsList.getValue("_unexistingmacro") != null) { >+ fail("getValue faild, %_libdir value don't end with '%{_lib}'"); >+ } >+ } >+ >+ public final void testGetMacroEval() { >+ if (!RpmMacroProposalsList.getMacroEval("%_libdir").endsWith("lib")) { >+ fail("getMacroEval faild, eval don't end with 'lib'"); >+ } >+ } >+ >+ public final void testGetMacroEval2() { >+ if (!RpmMacroProposalsList.getMacroEval("%_unexistingmacro").equals("%_unexistingmacro")) { >+ fail("getMacroEval faild, eval don't contain %_unexistingmacro macro name"); >+ } >+ } >+ >+} >Index: src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java >=================================================================== >--- src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java (révision 483) >+++ src/org/eclipse/linuxtools/rpm/ui/editor/tests/AllTests.java (copie de travail) >@@ -21,6 +21,8 @@ > suite.addTestSuite(LinePositionTests.class); > suite.addTestSuite(SourceComparatorTests.class); > suite.addTestSuite(RefactoringTests.class); >+ suite.addTestSuite(RpmMacroProposalsListTests.class); >+ suite.addTestSuite(RpmPackageProposalsListTests.class); > //$JUnit-END$ > return suite; > } >Index: src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTests.java >=================================================================== >--- src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTests.java (révision 0) >+++ src/org/eclipse/linuxtools/rpm/ui/editor/tests/RpmPackageProposalsListTests.java (révision 0) >@@ -0,0 +1,82 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Alphonse Van Assche. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Alphonse Van Assche - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.linuxtools.rpm.ui.editor.tests; >+ >+import java.io.BufferedWriter; >+import java.io.FileWriter; >+import java.io.IOException; >+import java.util.List; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.linuxtools.rpm.ui.editor.Activator; >+import org.eclipse.linuxtools.rpm.ui.editor.RpmPackageProposalsList; >+import org.eclipse.linuxtools.rpm.ui.editor.preferences.PreferenceConstants; >+ >+public class RpmPackageProposalsListTests extends TestCase { >+ >+ private RpmPackageProposalsList packageProposalsList; >+ >+ protected void setUp() throws Exception { >+ Activator.getDefault().getPluginPreferences().setValue( >+ PreferenceConstants.P_RPM_LIST_FILEPATH, "/tmp/pkglist"); >+ try { >+ BufferedWriter out = new BufferedWriter(new FileWriter("/tmp/pkglist")); >+ out.write("setup\ntest\n"); >+ out.close(); >+ } catch (IOException e) { >+ e.printStackTrace(); >+ } >+ packageProposalsList = new RpmPackageProposalsList(); >+ } >+ >+ protected void tearDown() { >+ String[] cmd = { "rm", "-f", "/tmp/pkglist" }; >+ try { >+ Runtime.getRuntime().exec(cmd); >+ } catch (IOException e) { >+ e.printStackTrace(); >+ } >+ } >+ >+ public final void testGetProposals() { >+ List proposals = packageProposalsList.getProposals("setup"); >+ if (!(proposals.size() == 1)) { >+ fail("getProposals faild, setup package was retrive as proposals!"); >+ } >+ } >+ >+ public final void testGetValue() { >+ if (!packageProposalsList.getValue("setup").startsWith("<b>Name: </b>setup")) { >+ fail("getValue faild, setup package info don't start with '<b>Name:<b> setup'"); >+ } >+ } >+ >+ public final void testGetValue2() { >+ if (!packageProposalsList.getValue("test").contains("test")) { >+ fail("getValue faild, test package info don't contain 'test'"); >+ } >+ } >+ >+ public final void testGetRpmInfo() { >+ if (!packageProposalsList.getRpmInfo("setup").startsWith("<b>Name: </b>setup")) { >+ fail("getRpmInfo faild, setup package info don't start with '<b>Name:<b> setup'"); >+ } >+ } >+ >+ public final void testGetRpmInfo2() { >+ if (!packageProposalsList.getRpmInfo("test").contains("test")) { >+ fail("getRpmInfo faild, test package info don't contain 'test'"); >+ } >+ } >+ >+}
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
Flags:
overholt
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 181236
: 63339