Bump BREEs to Java 1.8 for test bundles.
Change-Id: Ia086682cb0c35566697de87e632c15dc0622b3c4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tests/org.eclipse.dltk.python.tests/.classpath b/tests/org.eclipse.dltk.python.tests/.classpath
index 2fbb7a2..eca7bdb 100644
--- a/tests/org.eclipse.dltk.python.tests/.classpath
+++ b/tests/org.eclipse.dltk.python.tests/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.core.prefs
index 4a8b6b0..0c68a61 100644
--- a/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,7 @@
-#Fri Feb 12 15:49:40 NOVT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..43df84b
--- /dev/null
+++ b/tests/org.eclipse.dltk.python.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,59 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/tests/org.eclipse.dltk.python.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.python.tests/META-INF/MANIFEST.MF
index d04e0eb..59a2cbd 100644
--- a/tests/org.eclipse.dltk.python.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.dltk.python.tests/META-INF/MANIFEST.MF
@@ -13,10 +13,10 @@
org.junit,
org.eclipse.dltk.python.core,
org.eclipse.dltk.core.tests
-Eclipse-AutoStart: true
+Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.dltk.python.tests,
org.eclipse.dltk.python.tests.buildpath,
org.eclipse.dltk.python.tests.eval.generated,
org.eclipse.dltk.python.tests.model
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/PythonTestsPlugin.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/PythonTestsPlugin.java
index 4be41d2..42005a3 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/PythonTestsPlugin.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/PythonTestsPlugin.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests;
@@ -21,7 +20,7 @@
public static final String PLUGIN_NAME = "org.eclipse.dltk.python.tests";
//The shared instance.
private static PythonTestsPlugin plugin;
-
+
/**
* The constructor.
*/
@@ -32,6 +31,7 @@
/**
* This method is called upon plug-in activation
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
@@ -39,6 +39,7 @@
/**
* This method is called when the plug-in is stopped
*/
+ @Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/buildpath/BuildpathTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/buildpath/BuildpathTests.java
index f118259..8a34c4b 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/buildpath/BuildpathTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/buildpath/BuildpathTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.buildpath;
@@ -13,8 +12,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -22,18 +19,19 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IBuildpathEntry;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelMarker;
import org.eclipse.dltk.core.IModelStatus;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.environment.EnvironmentManager;
import org.eclipse.dltk.core.environment.EnvironmentPathUtils;
import org.eclipse.dltk.core.tests.model.ModifyingResourceTests;
-import org.eclipse.dltk.core.tests.util.Util;
import org.eclipse.dltk.internal.core.BuildpathEntry;
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.utils.CorePrinter;
+import junit.framework.Test;
+
public class BuildpathTests extends ModifyingResourceTests {
private static final String[] TEST_NATURE = new String[] { PythonNature.NATURE_ID };
@@ -46,19 +44,11 @@
return new Suite(BuildpathTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
}
- private void assertEncodeDecodeEntry(String projectName,
- String expectedEncoded, IBuildpathEntry entry) {
- IScriptProject project = getScriptProject(projectName);
- String encoded = project.encodeBuildpathEntry(entry);
- assertSourceEquals("Unexpected encoded entry", expectedEncoded, encoded);
- IBuildpathEntry decoded = project.decodeBuildpathEntry(encoded);
- assertEquals("Unexpected decoded entry", entry, decoded);
- }
-
protected void assertStatus(String expected, IStatus status) {
String actual = status.getMessage();
if (!expected.equals(actual)) {
@@ -114,6 +104,7 @@
return result;
}
+ @Override
public void tearDownSuite() throws Exception {
// TODO Auto-generated method stub
super.tearDownSuite();
@@ -136,18 +127,18 @@
// assertTrue(fragments[0] instanceof ArchiveProjectFragment);
// IProjectFragment fragment = fragments[0];
// IModelElement[] elements = fragment.getChildren();
- //
+ //
// System.out.println("Model:");
// CorePrinter printer = new CorePrinter(System.out);
// ((ScriptProject)project).printNode(printer);
// printer.flush();
- //
+ //
// deleteProject(BUILDPATH_PRJ_2);
// }
/**
* External folder Library BuildpathEntry test
- *
+ *
* @throws Exception
*/
public void test005() throws Exception {
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestbinops.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestbinops.java
index a551783..a8d725c 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestbinops.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestbinops.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestbinops extends AbstractModelTests
{
public genTestbinops(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestbinops.class);
}
- private String prj = "eval0_binops.py";
+ private String prj = "eval0_binops.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void testEval0() throws Exception {
testType( "binops.py", "a1", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass0.java
index 2c8309a..f3cf831 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass0.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestclass0 extends AbstractModelTests
{
public genTestclass0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestclass0.class);
}
- private String prj = "eval0_class0.py";
+ private String prj = "eval0_class0.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void testEval0() throws Exception {
testType( "class0.py", "a", "class:A instance" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass1.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass1.java
index b3207c1..e5ed744 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass1.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass1.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestclass1 extends AbstractModelTests
{
public genTestclass1(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestclass1.class);
}
- private String prj = "eval0_class1.py";
+ private String prj = "eval0_class1.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void testEval0() throws Exception {
testType( "class1.py", "a", "class:A instance" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass2.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass2.java
index 47e3f62..02ff13d 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass2.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass2.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestclass2 extends AbstractModelTests
{
public genTestclass2(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestclass2.class);
}
- private String prj = "eval0_class2.py";
+ private String prj = "eval0_class2.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "class2.py", "a", "class:A instance" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass_import0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass_import0.java
index 364a57e..3d733ee 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass_import0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestclass_import0.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestclass_import0 extends AbstractModelTests
{
public genTestclass_import0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestclass_import0.class);
}
- private String prj = "eval0_class_import0.py";
+ private String prj = "eval0_class_import0.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "class_import0.py", "ta0", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfromimport0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfromimport0.java
index 894a4bf..9fe0e36 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfromimport0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfromimport0.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestfromimport0 extends AbstractModelTests
{
public genTestfromimport0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestfromimport0.class);
}
- private String prj = "eval0_fromimport0.py";
+ private String prj = "eval0_fromimport0.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "fromimport0.py", "i1", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfunc0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfunc0.java
index 216d796..0a1fdfc 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfunc0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestfunc0.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestfunc0 extends AbstractModelTests
{
public genTestfunc0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestfunc0.class);
}
- private String prj = "eval0_func0.py";
+ private String prj = "eval0_func0.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "func0.py", "_a1", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport0.java
index f369330..33022a5 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport0.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestimport0 extends AbstractModelTests
{
public genTestimport0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestimport0.class);
}
- private String prj = "eval0_import0.py";
+ private String prj = "eval0_import0.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "import0.py", "im0", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport1.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport1.java
index 2c78acc..6378c99 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport1.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestimport1.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestimport1 extends AbstractModelTests
{
public genTestimport1(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestimport1.class);
}
- private String prj = "eval0_import1.py";
+ private String prj = "eval0_import1.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "import1.py", "i1", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestmethod0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestmethod0.java
index 17433e1..c88a715 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestmethod0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/eval/generated/genTestmethod0.java
@@ -3,10 +3,6 @@
import java.util.List;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.Path;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.MethodDeclaration;
@@ -20,33 +16,38 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.dltk.utils.CorePrinter;
+
+import junit.framework.Test;
public class genTestmethod0 extends AbstractModelTests
{
public genTestmethod0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( genTestmethod0.class);
}
- private String prj = "eval0_method0.py";
+ private String prj = "eval0_method0.py";
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpScriptProjectTo( prj, "eval0" );
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( prj );
}
private void testType( String moduleName, String name, String type ) throws Exception {
-
+
IScriptProject project = getScriptProject( prj );
ISourceModule module = this.getSourceModule( prj, "src", new Path( moduleName ) );
-
+
CorePrinter printer = new CorePrinter( System.out );
-
+
assertNotNull( module );
-
+
ModuleDeclaration astModule = PythonTypeEvaluatorUtils.parseModuleForElement(module);
PythonASTFindVisitor findVisitor = new PythonASTFindVisitor( name );
List nodes = findVisitor.getNodes( );
@@ -54,15 +55,15 @@
astModule.traverse( findVisitor );
int index = 0;
assertNotNull( nodes );
- assertEquals( "Element name should be unical", 1, nodes.size() );
+ assertEquals( "Element name should be unical", 1, nodes.size() );
ASTNode nde = (ASTNode)nodes.get( 0 );
- if( ! ( nde instanceof MethodDeclaration ) ) {
+ if( ! ( nde instanceof MethodDeclaration ) ) {
PythonASTTypeEvaluator evaluator = new PythonASTTypeEvaluator( module, astModule, findVisitor.getParents() );
IEvaluatedType evaluatedType = evaluator.evaluateASTNode( nde, null );
assertEquals( "Types not equal in module " + moduleName + " for variable: " + name, type, evaluatedType.getTypeName() );
}
}
-
+
public void REM_testEval0() throws Exception {
testType( "method0.py", "c1", "number" );
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ComplexConstructsTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ComplexConstructsTests.java
index 6298f26..1b1985d 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ComplexConstructsTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ComplexConstructsTests.java
@@ -4,8 +4,6 @@
import java.io.InputStream;
import java.util.List;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -23,6 +21,8 @@
import org.eclipse.dltk.python.parser.ast.PythonWithStatement;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
public class ComplexConstructsTests extends AbstractModelTests {
private static final String PROJECT_NAME = "pytests";
private static final String FOLDER = "src";
@@ -38,6 +38,7 @@
return new Suite(ComplexConstructsTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject sp = this.setUpScriptProject(PROJECT_NAME);
@@ -49,6 +50,7 @@
testFile.create(source, true, new NullProgressMonitor());
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject(PROJECT_NAME);
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveElementsTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveElementsTests.java
index 76f37e1..1ff445b 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveElementsTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveElementsTests.java
@@ -1,27 +1,24 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IModelStatus;
import org.eclipse.dltk.core.IModelStatusConstants;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.ModelException;
@@ -29,19 +26,23 @@
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
public class CopyMoveElementsTests extends CopyMoveTests {
private static final String[] PYTHON_NATURE = new String[] {
PythonNature.NATURE_ID
};
-
+
public CopyMoveElementsTests(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name );
}
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
-
+
IScriptProject project = this.createScriptProject("BinaryProject", PYTHON_NATURE, new String[] {"src"});
this.createFile(
"/BinaryProject/src/X.py",
@@ -57,11 +58,12 @@
/**
* Setup for the next test.
*/
+@Override
public void setUp() throws Exception {
super.setUp();
-
+
this.createScriptProject("P", PYTHON_NATURE, new String[] {"src", "bin"});
-
+
}
// Use this static initializer to specify subset for tests
// All specified tests which do not belong to the class are skipped...
@@ -78,11 +80,13 @@
/**
* Cleanup after the previous test.
*/
+@Override
public void tearDown() throws Exception {
this.deleteProject("P");
-
+
super.tearDown();
}
+@Override
public void tearDownSuite() throws Exception {
this.deleteProject("BinaryProject");
super.tearDownSuite();
@@ -99,6 +103,7 @@
private ISourceModule getSourceModule(String projectName, String rootPath, String packageName, String className) throws ModelException {
return getSourceModule(projectName, rootPath, new Path(packageName+className));
}
+@Override
public ISourceModule getSourceModule(String string) {
return getSourceModule(string);
}
@@ -142,7 +147,7 @@
copyPositive(methodSource, typeDest, null, null, false);
}
/**
- * Ensures that a constructor can be copied to a different type across projects.
+ * Ensures that a constructor can be copied to a different type across projects.
* The constructor should be automatically renamed to that of the destination type.
*/
public void testCopyConstructorInDifferentProject() throws CoreException {
@@ -155,7 +160,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("X");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -163,7 +168,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(methodSource, typeDest, null, null, false);
} finally {
@@ -216,7 +221,7 @@
copyPositive(fieldSource, typeDest, null, null, true);
}
/**
- * Ensures that a field can be copied to a different type across projects
+ * Ensures that a field can be copied to a different type across projects
* replacing an existing field.
*/
public void testCopyFieldForceInDifferentProject() throws CoreException {
@@ -229,7 +234,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("bar");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -238,7 +243,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(fieldSource, typeDest, null, null, true);
} finally {
this.deleteProject("P2");
@@ -257,7 +262,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("bar");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -265,7 +270,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(fieldSource, typeDest, null, null, false);
} finally {
this.deleteProject("P2");
@@ -319,7 +324,7 @@
copyPositive(fieldSource, typeDest, null, "bar", true);
}
/**
- * Ensures that a field can be copied to a different type across two different
+ * Ensures that a field can be copied to a different type across two different
* projects, and renamed, overwriting an existing field.
*/
public void testCopyFieldRenameForceInDifferentProject() throws CoreException {
@@ -332,7 +337,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -341,7 +346,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(fieldSource, typeDest, null, "bar", true);
} finally {
this.deleteProject("P2");
@@ -361,7 +366,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -369,7 +374,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(fieldSource, typeDest, null, "bar", false);
} finally {
this.deleteProject("P2");
@@ -430,14 +435,14 @@
e = true;
}
assertTrue("Should have been an exception", e);
-
+
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " Y.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " Y[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " Y.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " Y[*]: {CHILDREN | FINE GRAINED}\n" +
" foo[+]: {}"
);
@@ -461,7 +466,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -469,7 +474,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
IField[] fieldsSource = typeSource.getFields();
IModelElement[] dests = new IModelElement[fieldsSource.length];
for (int i = 0; i < dests.length; i++) {
@@ -488,14 +493,14 @@
e = true;
}
assertTrue("Should have been an exception", e);
-
+
assertDeltas(
"Unexpected delta",
- "P2[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " Y.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " Y[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P2[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " Y.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " Y[*]: {CHILDREN | FINE GRAINED}\n" +
" foo[+]: {}"
);
@@ -544,7 +549,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("bar");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -553,7 +558,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyNegative(fieldSource, typeDest, null, null, false, IModelStatusConstants.NAME_COLLISION);
} finally {
this.deleteProject("P2");
@@ -589,10 +594,10 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
ISourceModule cf = getSourceModule("P2", "/BinaryProject/bin", "", "X.class");
-
+
copyNegative(fieldSource, cf.getType("X"), null, null, false, IModelStatusConstants.INVALID_DESTINATION);
} finally {
this.deleteProject("P2");
@@ -620,11 +625,11 @@
IType typeDest = getSourceModule("/P/src/Y.py").getType("Y");
copyNegative(
- fieldSource,
- typeDest,
- typeDest.getField("invalid"),
- null,
- false,
+ fieldSource,
+ typeDest,
+ typeDest.getField("invalid"),
+ null,
+ false,
IModelStatusConstants.INVALID_SIBLING);
}
/**
@@ -641,7 +646,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -649,13 +654,13 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyNegative(
- fieldSource,
- typeDest,
- typeDest.getField("invalid"),
- null,
- false,
+ fieldSource,
+ typeDest,
+ typeDest.getField("invalid"),
+ null,
+ false,
IModelStatusConstants.INVALID_SIBLING);
} finally {
this.deleteProject("P2");
@@ -685,7 +690,7 @@
copyPositive(fieldSource, typeDest, typeDest.getField("bar"), null, false);
}
/**
- * Ensures that a field can be copied to a different type across different projects
+ * Ensures that a field can be copied to a different type across different projects
* with positioning.
*/
public void testCopyFieldWithPositioningInDifferentProject() throws CoreException {
@@ -698,7 +703,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -707,7 +712,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(fieldSource, typeDest, typeDest.getField("bar"), null, false);
} finally {
this.deleteProject("P2");
@@ -804,7 +809,7 @@
// );
// IType typeSource = getSourceModule("/P/src/X.py").getType("X");
// IInitializer initializerSource= typeSource.getInitializer(1);
-//
+//
// this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
// this.createFile(
// "/P2/src/Y.py",
@@ -812,7 +817,7 @@
// " pass"
// );
// IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-//
+//
// copyPositive(initializerSource, typeDest, null, null, false);
// } finally {
// this.deleteProject("P2");
@@ -859,7 +864,7 @@
// );
// IType typeSource = getSourceModule("/P/src/X.py").getType("X");
// IInitializer initializerSource= typeSource.getInitializer(1);
-//
+//
// this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
// this.createFile(
// "/P2/src/Y.py",
@@ -867,7 +872,7 @@
// " pass"
// );
// IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-//
+//
// copyNegative(initializerSource, typeDest, null, "newName", false, IModelStatusConstants.INVALID_NAME);
// } finally {
// this.deleteProject("P2");
@@ -890,7 +895,7 @@
// );
// IType typeSource = getSourceModule("/P/src/X.py").getType("X");
// IInitializer initializerSource= typeSource.getInitializer(1);
-//
+//
// this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
// this.createFile(
// "/P2/src/Y.py",
@@ -899,7 +904,7 @@
// " pass"
// );
// IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-//
+//
// copyPositive(initializerSource, typeDest, typeDest.getField("bar"), null, false);
// } finally {
// this.deleteProject("P2");
@@ -914,11 +919,11 @@
"/P/src/X.py",
"class X:\n" +
" class Inner {\n" +
- " }" +
+ " }" +
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X").getType("Inner");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -928,7 +933,7 @@
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
IType typeDest = cuDest.getType("Y");
-
+
copyPositive(typeSource, typeDest, typeDest.getMethod("foo"), null, false);
} finally {
this.deleteProject("P2");
@@ -947,7 +952,7 @@
// " }\n" +
// " pass"
// );
-// //TODO: getType("X").getMethod("foo").getType
+// //TODO: getType("X").getMethod("foo").getType
// IType typeSource = getSourceModule("/P/src/X.py").getType("X").getMethod("foo").getType("Z");
//
// this.createFile(
@@ -990,7 +995,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -998,7 +1003,7 @@
" pass"
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
-
+
copyPositive(typeSource, cuDest, null, null, false);
} finally {
this.deleteProject("P2");
@@ -1051,7 +1056,7 @@
copyPositive(methodSource, typeDest, null, null, true);
}
/**
- * Ensures that a method can be copied to a different type across different projects,
+ * Ensures that a method can be copied to a different type across different projects,
* forcing an overwrite when there is a name collision
*/
public void testCopyMethodForceInDifferentProject() throws CoreException {
@@ -1064,7 +1069,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1073,7 +1078,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(methodSource, typeDest, null, null, true);
} finally {
this.deleteProject("P2");
@@ -1092,7 +1097,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1154,7 +1159,7 @@
copyPositive(methodSource, typeDest, null, "bar", true);
}
/**
- * Ensures that a method can be copied to a different type across different projects,
+ * Ensures that a method can be copied to a different type across different projects,
* renamed simaltaneously, overwriting an existing method.
*/
public void testCopyMethodRenameForceInDifferentProject() throws CoreException {
@@ -1167,7 +1172,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1183,7 +1188,7 @@
}
}
/**
- * Ensures that a method can be copied to a different type across different projects,
+ * Ensures that a method can be copied to a different type across different projects,
* renamed simaltaneously.
*/
public void testCopyMethodRenameInDifferentProject() throws CoreException {
@@ -1196,7 +1201,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1204,7 +1209,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(methodSource, typeDest, null, "bar", false);
} finally {
this.deleteProject("P2");
@@ -1251,7 +1256,7 @@
copyNegative(methodSource, typeDest, null, null, false, IModelStatusConstants.NAME_COLLISION);
}
/**
- * Ensures that a method cannot be copied to a different type across different projects,
+ * Ensures that a method cannot be copied to a different type across different projects,
* when not forcing an overwrite when there is a name collision
*/
public void testCopyMethodWithCollisionInDifferentProject() throws CoreException {
@@ -1264,7 +1269,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1273,7 +1278,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyNegative(methodSource, typeDest, null, null, false, IModelStatusConstants.NAME_COLLISION);
} finally {
this.deleteProject("P2");
@@ -1307,7 +1312,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1317,7 +1322,7 @@
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
IMethod methodDest = typeDest.getMethod("bar");
-
+
copyNegative(methodSource, methodDest, null, null, false, IModelStatusConstants.INVALID_DESTINATION);
} finally {
this.deleteProject("P2");
@@ -1336,7 +1341,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1345,7 +1350,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(methodSource, typeDest, typeDest.getMethod("bar"), null, false);
} finally {
this.deleteProject("P2");
@@ -1364,11 +1369,11 @@
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("foo");
copyNegative(
- new IModelElement[] {methodSource},
- new IModelElement[] {typeSource},
- null,
- new String[] {"bar", "fred"},
- false,
+ new IModelElement[] {methodSource},
+ new IModelElement[] {typeSource},
+ null,
+ new String[] {"bar", "fred"},
+ false,
IModelStatusConstants.INDEX_OUT_OF_BOUNDS);
}
/**
@@ -1407,7 +1412,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1415,7 +1420,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
copyPositive(methodSource, typeDest, null, null, false);
} finally {
this.deleteProject("P2");
@@ -1456,7 +1461,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("Z");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1464,7 +1469,7 @@
" pass"
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
-
+
copyPositive(typeSource, cuDest, null, null, false);
} finally {
this.deleteProject("P2");
@@ -1483,7 +1488,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("Z");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1491,7 +1496,7 @@
" pass"
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
-
+
copyPositive(typeSource, cuDest, cuDest.getType("Y"), null, false);
} finally {
this.deleteProject("P2");
@@ -1519,14 +1524,14 @@
IType typeDest = getSourceModule("/P/src/Y.py").getType("Y");
movePositive(methodSource, typeDest, null, null, false);
-
+
// test that the constructor has been renamed
assertTrue(
- "Constructor was not renamed",
+ "Constructor was not renamed",
typeDest.getMethod("Y").exists());
}
/**
- * Ensures that a constructor can be moved to a different type across different projects.
+ * Ensures that a constructor can be moved to a different type across different projects.
* The constructor should be automatically renamed to that of the destination type.
*/
public void testMoveConstructorInDifferentProject() throws CoreException {
@@ -1539,7 +1544,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("X");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1547,12 +1552,12 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(methodSource, typeDest, null, null, false);
// test that the constructor has been renamed
assertTrue(
- "Constructor was not renamed",
+ "Constructor was not renamed",
typeDest.getMethod("Y").exists());
} finally {
this.deleteProject("P2");
@@ -1604,7 +1609,7 @@
movePositive(fieldSource, typeDest, null, null, true);
}
/**
- * Ensures that a field can be moved to a different type across differnt projects
+ * Ensures that a field can be moved to a different type across differnt projects
* replacing an existing field.
*/
public void testMoveFieldForceInDifferentProject() throws CoreException {
@@ -1617,7 +1622,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("bar");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1626,7 +1631,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(fieldSource, typeDest, null, null, true);
} finally {
this.deleteProject("P2");
@@ -1645,7 +1650,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("bar");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1653,7 +1658,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(fieldSource, typeDest, null, null, false);
} finally {
this.deleteProject("P2");
@@ -1720,7 +1725,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1729,7 +1734,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(fieldSource, typeDest, null, "bar", true);
} finally {
this.deleteProject("P2");
@@ -1749,7 +1754,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1757,14 +1762,14 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(fieldSource, typeDest, null, "bar", false);
} finally {
this.deleteProject("P2");
}
}
/**
- * Ensures that a field can be copied to a different type across different projects
+ * Ensures that a field can be copied to a different type across different projects
* with positioning.
*/
public void testMoveFieldRenameForceWithPositioningInDifferentProject() throws CoreException {
@@ -1777,7 +1782,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1787,7 +1792,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(fieldSource, typeDest, typeDest.getField("bar"), "fred", true);
} finally {
this.deleteProject("P2");
@@ -1846,7 +1851,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("bar");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1855,7 +1860,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
moveNegative(fieldSource, typeDest, null, null, false, IModelStatusConstants.NAME_COLLISION);
} finally {
this.deleteProject("P2");
@@ -1891,17 +1896,17 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
ISourceModule cf = getSourceModule("P2", "/BinaryProject/bin", "", "X.class");
-
+
moveNegative(fieldSource, cf.getType("X"), null, null, false, IModelStatusConstants.INVALID_DESTINATION);
} finally {
this.deleteProject("P2");
}
}
/**
- * Ensures that a field can be copied to a different type across different projects
+ * Ensures that a field can be copied to a different type across different projects
* with positioning.
*/
public void testMoveFieldWithPositioningInDifferentProject() throws CoreException {
@@ -1914,7 +1919,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IField fieldSource= typeSource.getField("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -1923,7 +1928,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(fieldSource, typeDest, typeDest.getField("bar"), null, false);
} finally {
this.deleteProject("P2");
@@ -1972,7 +1977,7 @@
// );
// IType typeSource = getSourceModule("/P/src/X.py").getType("X");
// IInitializer initializerSource= typeSource.getInitializer(1);
-//
+//
// this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
// this.createFile(
// "/P2/src/Y.py",
@@ -1980,7 +1985,7 @@
// " pass"
// );
// IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-//
+//
// movePositive(initializerSource, typeDest, null, null, false);
// } finally {
// this.deleteProject("P2");
@@ -2027,7 +2032,7 @@
// );
// IType typeSource = getSourceModule("/P/src/X.py").getType("X");
// IInitializer initializerSource= typeSource.getInitializer(1);
-//
+//
// this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
// this.createFile(
// "/P2/src/Y.py",
@@ -2035,14 +2040,14 @@
// " pass"
// );
// IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-//
+//
// moveNegative(initializerSource, typeDest, null, "newName", false, IModelStatusConstants.INVALID_NAME);
// } finally {
// this.deleteProject("P2");
// }
//}
///**
-// * Ensures that a initializer can be moved to a different type in a different project
+// * Ensures that a initializer can be moved to a different type in a different project
// * with positioning.
// */
//public void testMoveInitializerWithPositioningInDifferentProject() throws CoreException {
@@ -2058,7 +2063,7 @@
// );
// IType typeSource = getSourceModule("/P/src/X.py").getType("X");
// IInitializer initializerSource= typeSource.getInitializer(1);
-//
+//
// this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
// this.createFile(
// "/P2/src/Y.py",
@@ -2067,7 +2072,7 @@
// " pass"
// );
// IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-//
+//
// movePositive(initializerSource, typeDest, typeDest.getField("bar"), null, false);
// } finally {
// this.deleteProject("P2");
@@ -2083,11 +2088,11 @@
"/P/src/X.py",
"class X:\n" +
" class Inner {\n" +
- " }" +
+ " }" +
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X").getType("Inner");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2116,7 +2121,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X").getType("Inner");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2126,7 +2131,7 @@
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
IType typeDest = cuDest.getType("Y");
-
+
movePositive(typeSource, typeDest, typeDest.getMethod("foo"), null, false);
} finally {
this.deleteProject("P2");
@@ -2146,10 +2151,10 @@
IType typeSource = cu.getType("X");
movePositive(
- new IModelElement[] {typeSource},
- new IModelElement[] {cu},
- null,
- new String[] {"Y"},
+ new IModelElement[] {typeSource},
+ new IModelElement[] {cu},
+ null,
+ new String[] {"Y"},
false);
// test that both the compilation unit and the main type have been renamed.
@@ -2216,7 +2221,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2225,7 +2230,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(methodSource, typeDest, null, null, true);
} finally {
this.deleteProject("P2");
@@ -2244,7 +2249,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2319,7 +2324,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2348,7 +2353,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2356,7 +2361,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(methodSource, typeDest, null, "bar", false);
} finally {
this.deleteProject("P2");
@@ -2376,7 +2381,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2385,7 +2390,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(methodSource, typeDest, typeDest.getMethod("bar"), "fred", false);
} finally {
this.deleteProject("P2");
@@ -2452,7 +2457,7 @@
" pass"
);
final IType typeSource = getSourceModule("/P/src/X.py").getType("X");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2461,7 +2466,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
boolean isCanceled = false;
try {
TestProgressMonitor monitor = TestProgressMonitor.getInstance();
@@ -2513,7 +2518,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2522,7 +2527,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
moveNegative(methodSource, typeDest, null, null, false, IModelStatusConstants.NAME_COLLISION);
} finally {
this.deleteProject("P2");
@@ -2556,7 +2561,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2566,7 +2571,7 @@
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
IMethod methodDest = typeDest.getMethod("bar");
-
+
moveNegative(methodSource, methodDest, null, null, false, IModelStatusConstants.INVALID_DESTINATION);
} finally {
this.deleteProject("P2");
@@ -2586,7 +2591,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource = typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2595,7 +2600,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(methodSource, typeDest, typeDest.getMethod("bar"), null, false);
} finally {
this.deleteProject("P2");
@@ -2637,7 +2642,7 @@
);
IType typeSource = getSourceModule("/P/src/X.py").getType("X");
IMethod methodSource= typeSource.getMethod("foo");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2645,7 +2650,7 @@
" pass"
);
IType typeDest = getSourceModule("/P2/src/Y.py").getType("Y");
-
+
movePositive(methodSource, typeDest, null, null, false);
} finally {
this.deleteProject("P2");
@@ -2664,7 +2669,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("Z");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2672,7 +2677,7 @@
" pass"
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
-
+
movePositive(typeSource, cuDest, cuDest.getType("Y"), "T", false);
} finally {
this.deleteProject("P2");
@@ -2691,7 +2696,7 @@
" pass"
);
IType typeSource = getSourceModule("/P/src/X.py").getType("Z");
-
+
this.createScriptProject("P2", PYTHON_NATURE, new String[] {"src", "bin"});
this.createFile(
"/P2/src/Y.py",
@@ -2699,7 +2704,7 @@
" pass"
);
ISourceModule cuDest = getSourceModule("/P2/src/Y.py");
-
+
movePositive(typeSource, cuDest, cuDest.getType("Y"), null, false);
} finally {
this.deleteProject("P2");
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveResourcesTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveResourcesTests.java
index 00f5a03..9c8fea6 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveResourcesTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/CopyMoveResourcesTests.java
@@ -1,16 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -28,12 +25,14 @@
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
public class CopyMoveResourcesTests extends CopyMoveTests {
private static final String[] PYTHON_NATURE = new String[] {
PythonNature.NATURE_ID
};
-
+
public CopyMoveResourcesTests(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name );
}
@@ -42,22 +41,23 @@
* and forcing. The operation should succeed, so any exceptions
* encountered are thrown.
*/
+@Override
public IModelElement copyPositive(IModelElement element, IModelElement container, IModelElement sibling, String rename, boolean force) throws ModelException {
try {
startDeltas();
-
+
// if forcing, ensure that a name collision exists
if (force) {
IModelElement collision = generateHandle(element, rename, container);
assertTrue("Collision does not exist", collision.exists());
}
-
+
// copy
((ISourceManipulation) element).copy(container, sibling, rename, force, null);
-
+
// ensure the original element still exists
assertTrue("The original element must still exist", element.exists());
-
+
// generate the new element handle
IModelElement copy = generateHandle(element, rename, container);
assertTrue("Copy should exist", copy.exists());
@@ -110,10 +110,11 @@
* and forcing. The operation should succeed, so any exceptions
* encountered are thrown.
*/
+@Override
public void movePositive(IModelElement[] elements, IModelElement[] destinations, IModelElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws ModelException {
try {
startDeltas();
-
+
// if forcing, ensure that a name collision exists
int i;
if (force) {
@@ -128,10 +129,10 @@
assertTrue("Collision does not exist", collision.exists());
}
}
-
+
// move
getScriptModel().move(elements, destinations, siblings, names, force, monitor);
-
+
for (i = 0; i < elements.length; i++) {
IModelElement element = elements[i];
IModelElement moved = null;
@@ -146,7 +147,7 @@
assertTrue("The original element must not exist", !element.exists());
}
assertTrue("Moved element should exist", moved.exists());
-
+
// TODO: Package declarations
// IModelElement container = destinations[i];
// if (container.getElementType() == IModelElement.SCRIPT_FOLDER) {
@@ -206,9 +207,10 @@
/**
* Setup for the next test.
*/
+@Override
public void setUp() throws Exception {
super.setUp();
-
+
this.createScriptProject("P", PYTHON_NATURE, new String[] {"src", "src2", "bin"});
}
static {
@@ -220,9 +222,10 @@
/**
* Cleanup after the previous test.
*/
+@Override
public void tearDown() throws Exception {
this.deleteProject("P");
-
+
super.tearDown();
}
//TODO: Package declarations
@@ -242,7 +245,7 @@
// IScriptFolder pkgDest = getPackage("/P/src/p2");
//
// copyPositive(cuSource, pkgDest, null, null, false);
-//
+//
// ISourceModule cu= pkgDest.getSourceModule("X.py");
// assertTrue("Package declaration not updated for copied cu", cu.getPackageDeclaration("p2").exists());
//}
@@ -260,11 +263,11 @@
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copyNegative(
- new IModelElement[]{cuSource, cuSource.getType("X")},
- new IModelElement[]{cuSource.getParent(), cuSource},
- null,
- new String[]{"Y.py", "Y"},
- false,
+ new IModelElement[]{cuSource, cuSource.getType("X")},
+ new IModelElement[]{cuSource.getParent(), cuSource},
+ null,
+ new String[]{"Y.py", "Y"},
+ false,
IModelStatusConstants.INVALID_ELEMENT_TYPES);
}
/**
@@ -308,7 +311,7 @@
// IScriptFolder pkgDest = getPackage("/P/src/p");
//
// copyPositive(cuSource, pkgDest, null, null, false);
-//
+//
// ISourceModule cu= pkgDest.getSourceModule("X.py");
// assertTrue("Package declaration not updated for copied cu", cu.getPackageDeclaration("p").exists());
//}
@@ -347,12 +350,12 @@
);
setReadOnly(file, true);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
-
+
this.createFolder("/P/src/p2");
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
copyPositive(cuSource, pkgDest, null, null, false);
-
+
file2 = getFile("/P/src/p2/X.py");
assertTrue("Destination cu should be read-only", file2.isReadOnly());
} finally {
@@ -517,11 +520,11 @@
setReadOnly(pkgSource.getResource(), true);
pkg2 = getPackage("/P/src/p1/p2/p3");
setReadOnly(pkg2.getResource(), true);
-
+
IProjectFragment rootDest= getProjectFragment("P", "src2");
-
+
copyPositive(pkg2, rootDest, null, null, false);
-
+
assertTrue("Not readOnly", isReadOnly(getPackage("/P/src2/p1").getResource()));
assertTrue("Is readOnly", !isReadOnly(getPackage("/P/src2/p1/p2").getResource()));
assertTrue("Not readOnly", isReadOnly(getPackage("/P/src2/p1/p2/p3").getResource()));
@@ -567,10 +570,10 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
this.createFolder("/P/src/p2");
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
copyPositive(copy, pkgDest, null, null, false);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -592,7 +595,7 @@
" pass"
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
-
+
createFolder("/P/src/p2");
IScriptFolder pkgDest = getPackage("/P/src/p2");
createFile(
@@ -604,7 +607,7 @@
);
copy = getSourceModule("/P/src/p2/X.py");
copy.becomeWorkingCopy(null, null);
-
+
copyPositive(cuSource, pkgDest, null, null, true/*force*/);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -625,7 +628,7 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
this.createFolder("/P/src/p2");
this.createFile(
"/P/src/p2/X.py",
@@ -634,7 +637,7 @@
" pass"
);
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
copyPositive(copy, pkgDest, null, null, true);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -656,10 +659,10 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
this.createFolder("/P/src/p2");
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
copyPositive(copy, pkgDest, null, "Y.py", false);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -681,7 +684,7 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
this.createFolder("/P/src/p2");
this.createFile(
"/P/src/p2/Y.py",
@@ -690,7 +693,7 @@
" pass"
);
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
copyPositive(copy, pkgDest, null, "Y.py", true);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -711,7 +714,7 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
this.createFolder("/P/src/p2");
this.createFile(
"/P/src/p2/X.py",
@@ -720,7 +723,7 @@
" pass"
);
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
copyNegative(copy, pkgDest, null, null, false, IModelStatusConstants.NAME_COLLISION);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -741,7 +744,7 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
copyNegative(copy, cuSource, null, null, false, IModelStatusConstants.INVALID_DESTINATION);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -765,7 +768,7 @@
// IScriptFolder pkgDest = getPackage("/P/src/p2");
//
// movePositive(cuSource, pkgDest, null, null, false);
-//
+//
// ISourceModule cu= pkgDest.getSourceModule("X.py");
// assertTrue("Package declaration not updated for copied cu", cu.getPackageDeclaration("p2").exists());
//}
@@ -786,11 +789,11 @@
// ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
//
// moveNegative(
-// new IModelElement[]{cuSource, cuSource.getType("T")},
-// new IModelElement[]{cuSource.getParent(), cuSource},
-// null,
-// new String[]{"Y.py", "Y"},
-// false,
+// new IModelElement[]{cuSource, cuSource.getType("T")},
+// new IModelElement[]{cuSource.getParent(), cuSource},
+// null,
+// new String[]{"Y.py", "Y"},
+// false,
// IModelStatusConstants.INVALID_ELEMENT_TYPES);
//}
/**
@@ -958,11 +961,11 @@
setReadOnly(pkgSource.getResource(), true);
pkg2 = getPackage("/P/src/p1/p2/p3");
setReadOnly(pkg2.getResource(), true);
-
+
IProjectFragment rootDest= getProjectFragment("P", "src2");
-
+
movePositive(pkg2, rootDest, null, null, false);
-
+
assertTrue("Not readOnly", isReadOnly(getPackage("/P/src2/p1").getResource()));
assertTrue("Is readOnly", !isReadOnly(getPackage("/P/src2/p1/p2").getResource()));
assertTrue("Not readOnly", isReadOnly(getPackage("/P/src2/p1/p2/p3").getResource()));
@@ -1008,10 +1011,10 @@
);
ISourceModule cuSource = getSourceModule("/P/src/p1/X.py");
copy = cuSource.getWorkingCopy(null);
-
+
this.createFolder("/P/src/p2");
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
moveNegative(copy, pkgDest, null, null, false, IModelStatusConstants.INVALID_ELEMENT_TYPES);
} finally {
if (copy != null) copy.discardWorkingCopy();
@@ -1035,10 +1038,10 @@
);
copy = getSourceModule("/P/src/p1/X.py");
copy.becomeWorkingCopy(null, null);
-
+
this.createFolder("/P/src/p2");
IScriptFolder pkgDest = getPackage("/P/src/p2");
-
+
movePositive(copy, pkgDest, null, null, false);
assertTrue("Should not have unsaved changes", !copy.getBuffer().hasUnsavedChanges());
} finally {
@@ -1046,6 +1049,7 @@
}
}
+ @Override
public void startDeltas() {
waitUntilIndexesReady();
super.startDeltas();
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteResourcesTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteResourcesTests.java
index 760d265..84c015b 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteResourcesTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteResourcesTests.java
@@ -1,16 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -26,6 +23,8 @@
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
/*
* Tests for ISourceManipulation.delete(...)
@@ -37,6 +36,7 @@
super(PythonTestsPlugin.PLUGIN_NAME, name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
// ensure that indexing is not going to interfer with deletion
@@ -45,11 +45,13 @@
createScriptProject("P", PYTHON_NATURE, new String[] { "" });
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
deleteProject("P");
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
}
@@ -66,6 +68,7 @@
// TESTS_RANGE = new int[] { 16, -1 };
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
}
@@ -126,6 +129,7 @@
startDeltas();
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
cu.delete(true, null);
assertTrue("Should be able to delete a CU", !cu.exists());
@@ -288,6 +292,7 @@
}
+ @Override
public void startDeltas() {
waitUntilIndexesReady();
super.startDeltas();
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteTests.java
index 7ed9053..c2d002b 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/DeleteTests.java
@@ -1,16 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
@@ -28,6 +25,8 @@
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
/*
* Tests for ISourceManipulation.delete(...)
@@ -36,11 +35,12 @@
private static final String[] PYTHON_NATURE = new String[] {
PythonNature.NATURE_ID
};
-
+
public DeleteTests(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name );
}
+@Override
protected void setUp() throws Exception {
super.setUp();
// ensure that indexing is not going to interfer with deletion
@@ -49,11 +49,13 @@
createScriptProject("P", PYTHON_NATURE, new String[]{""});
}
+@Override
protected void tearDown() throws Exception {
super.tearDown();
deleteProject("P");
}
+@Override
public void setUpSuite() throws Exception {
super.setUpSuite();
}
@@ -67,6 +69,7 @@
// TESTS_NUMBERS = new int[] { 2, 12 };
// TESTS_RANGE = new int[] { 16, -1 };
}
+@Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
}
@@ -88,11 +91,11 @@
assertDeletion(field);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" field[-]: {}"
);
} finally {
@@ -145,20 +148,21 @@
startDeltas();
getWorkspace().run(
new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
assertDeletion(field);
}
- },
+ },
file,
IWorkspace.AVOID_UPDATE,
null);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" field[-]: {}"
);
} finally {
@@ -184,8 +188,8 @@
// IField field = cu.getType("X").getField("t");
// field.delete(false, null);
// assertSourceEquals(
-// "Unexpected source",
-// "class X:\n" +
+// "Unexpected source",
+// "class X:\n" +
// " pass",
// cu.getSource());
// } finally {
@@ -209,9 +213,9 @@
// IField field = cu.getType("X").getField("A");
// field.delete(false, null);
// assertSourceEquals(
-// "Unexpected source",
-// "public enum X {\n" +
-// " B, C\n" +
+// "Unexpected source",
+// "public enum X {\n" +
+// " B, C\n" +
// " pass",
// cu.getSource());
// } finally {
@@ -238,11 +242,11 @@
// assertDeletion(imp);
// assertDeltas(
// "Unexpected delta",
-// "P[*]: {CHILDREN}\n" +
-// " <project root>[*]: {CHILDREN}\n" +
-// " <default>[*]: {CHILDREN}\n" +
-// " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
-// " <import container>[*]: {CHILDREN | FINE GRAINED}\n" +
+// "P[*]: {CHILDREN}\n" +
+// " <project root>[*]: {CHILDREN}\n" +
+// " <default>[*]: {CHILDREN}\n" +
+// " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+// " <import container>[*]: {CHILDREN | FINE GRAINED}\n" +
// " import q.Y[-]: {}"
// );
// } finally {
@@ -268,11 +272,11 @@
assertDeletion(method);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" foo()[-]: {}"
);
} finally {
@@ -319,7 +323,7 @@
// " }\n" +
// " pass"
// );
-//
+//
// // elements to be deleted:
// // from a/b/c/X.py:
// // java.util.Vector
@@ -328,15 +332,15 @@
// // Bar (constructor)
// // test
// // Bar (inner type, same as above)
-//
+//
// // from a/b/Y.py
// // foo
// // main
-//
+//
// ISourceModule cuX = getSourceModule("P/a/b/c/X.py");
// IType typeX = cuX.getType("X");
// IType typeBar = typeX.getType("Bar");
-//
+//
// IModelElement[] toBeDeleted = new IModelElement[8];
// toBeDeleted[0] = cuX.getImport("java.util.Vector");
// toBeDeleted[1] = typeX.getMethod("main");
@@ -344,30 +348,30 @@
// toBeDeleted[3] = typeBar.getMethod("Bar");
// toBeDeleted[4] = typeBar.getMethod("test");
// toBeDeleted[5] = typeBar;
-//
+//
// ISourceModule cuY = getSourceModule("P/a/b/Y.py");
// IType typeY = cuY.getType("Y");
-//
+//
// toBeDeleted[6] = typeY.getField("foo");
// toBeDeleted[7] = typeY.getMethod("main");
-//
+//
// startDeltas();
// assertDeletion(toBeDeleted);
// assertDeltas(
// "Unexpected delta",
-// "P[*]: {CHILDREN}\n" +
-// " <project root>[*]: {CHILDREN}\n" +
-// " a.b.c[*]: {CHILDREN}\n" +
-// " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
-// " <import container>[*]: {CHILDREN | FINE GRAINED}\n" +
-// " import java.util.Vector[-]: {}\n" +
-// " X[*]: {CHILDREN | FINE GRAINED}\n" +
-// " main(String[])[-]: {}\n" +
-// " Bar[-]: {}\n" +
-// " a.b[*]: {CHILDREN}\n" +
-// " Y.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
-// " Y[*]: {CHILDREN | FINE GRAINED}\n" +
-// " foo[-]: {}\n" +
+// "P[*]: {CHILDREN}\n" +
+// " <project root>[*]: {CHILDREN}\n" +
+// " a.b.c[*]: {CHILDREN}\n" +
+// " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+// " <import container>[*]: {CHILDREN | FINE GRAINED}\n" +
+// " import java.util.Vector[-]: {}\n" +
+// " X[*]: {CHILDREN | FINE GRAINED}\n" +
+// " main(String[])[-]: {}\n" +
+// " Bar[-]: {}\n" +
+// " a.b[*]: {CHILDREN}\n" +
+// " Y.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+// " Y[*]: {CHILDREN | FINE GRAINED}\n" +
+// " foo[-]: {}\n" +
// " main(String[])[-]: {}"
// );
// } finally {
@@ -396,10 +400,10 @@
// assertDeletion(packageDeclaration);
// assertDeltas(
// "Unexpected delta",
-// "P[*]: {CHILDREN}\n" +
-// " <project root>[*]: {CHILDREN}\n" +
-// " a.b.c[*]: {CHILDREN}\n" +
-// " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+// "P[*]: {CHILDREN}\n" +
+// " <project root>[*]: {CHILDREN}\n" +
+// " a.b.c[*]: {CHILDREN}\n" +
+// " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
// " package a.b.c[-]: {}"
// );
// } finally {
@@ -425,11 +429,11 @@
assertDeletion(field);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" field[-]: {}"
);
} finally {
@@ -439,7 +443,7 @@
}
private void assertDeletion(IModelElement element) throws ModelException {
assertDeletion(new IModelElement[] {element});
-
+
}
/**
@@ -462,11 +466,11 @@
assertDeletion(method);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" foo()[-]: {}"
);
} finally {
@@ -492,11 +496,11 @@
assertDeletion(method);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" foo()[-]: {}"
);
} finally {
@@ -523,11 +527,11 @@
assertDeletion(method);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
- " X[*]: {CHILDREN | FINE GRAINED}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ " X[*]: {CHILDREN | FINE GRAINED}\n" +
" foo()[-]: {}"
);
} finally {
@@ -553,10 +557,10 @@
assertDeletion(type);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
" X[-]: {}"
);
} finally {
@@ -581,10 +585,10 @@
assertDeletion(type);
assertDeltas(
"Unexpected delta",
- "P[*]: {CHILDREN}\n" +
- " <project root>[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " <project root>[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
" X[-]: {}"
);
} finally {
@@ -611,10 +615,10 @@
assertDeletion(type);
assertDeltas(
"Unexpected delta",
- "P1[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
- " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
+ "P1[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " X.py[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" +
" X[-]: {}"
);
} finally {
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/EncodingTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/EncodingTests.java
index 7b61df5..4dc9b37 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/EncodingTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/EncodingTests.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
@@ -13,9 +12,6 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import junit.framework.Assert;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRunnable;
@@ -27,10 +23,10 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.dltk.core.DLTKCore;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IOpenable;
import org.eclipse.dltk.core.IProjectFragment;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ISourceReference;
import org.eclipse.dltk.core.ModelException;
@@ -39,12 +35,15 @@
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Assert;
+import junit.framework.Test;
+
public class EncodingTests extends ModifyingResourceTests {
private static final String[] PYTHON_NATURE = new String[] {
PythonNature.NATURE_ID
};
-
+
IProject encodingProject;
IScriptProject encodingScriptProject;
IFile utf8File;
@@ -57,7 +56,7 @@
public EncodingTests(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name );
}
-
+
public static Test suite() {
return new Suite(EncodingTests.class);
}
@@ -69,15 +68,18 @@
// TESTS_RANGE = new int[] { 16, -1 };
}
+ @Override
public void setUpSuite() throws Exception {
setUpSuite = true;
super.setUpSuite();
}
+ @Override
public void tearDownSuite() throws Exception {
setUpSuite = false;
super.tearDownSuite();
}
+ @Override
protected void setUp() throws Exception {
// if(!setUpSuite) {
// setUpSuite();
@@ -88,7 +90,7 @@
encodingScriptProject = setUpScriptProject("Encoding");
this.encodingProject = (IProject) encodingScriptProject.getResource();
utf8File = (IFile) this.encodingProject.findMember("src/testUTF8/Test.py");
-
+
}
/*
@@ -96,6 +98,7 @@
* Reset UTF-8 file and project charset to default.
* @see junit.framework.TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
this.encodingProject.setDefaultCharset(null, null);
if (utf8File.exists()) utf8File.setCharset(null, null);
@@ -144,16 +147,16 @@
String savedEncoding = null;
try {
Preferences preferences = ResourcesPlugin.getPlugin().getPluginPreferences();
-
+
savedEncoding = preferences.getString(ResourcesPlugin.PREF_ENCODING);
String encoding = "UTF-8";
preferences.setValue(ResourcesPlugin.PREF_ENCODING, encoding);
-
+
ResourcesPlugin.getPlugin().savePluginPreferences();
IScriptProject newProject = createScriptProject("P", PYTHON_NATURE, new String[] { "" });
IScriptFolder pkg = getScriptFolder("P", "", new Path(""));
- String source =
+ String source =
"class A:\r\n" +
" def main(*args) :\r\n" +
" print(\"\u00e9\");\r\n" +
@@ -181,7 +184,7 @@
preferences.setValue(ResourcesPlugin.PREF_ENCODING, savedEncoding);
ResourcesPlugin.getPlugin().savePluginPreferences();
}
- }
+ }
/*
##################
@@ -197,7 +200,7 @@
// Set file encoding
String encoding = "UTF-8";
utf8File.setCharset(encoding, null);
-
+
// Get source and compare with file contents
Assert.assertTrue("", utf8File.exists());
utf8Source = getSourceModule(utf8File.getFullPath().toString());
@@ -214,7 +217,7 @@
for (int i = 0, max = sourceBytes.length; i < max; i++) {
assertTrue("Wrong size of encoded character at " + i, sourceBytes[i] == encodedBytes[i]);
}
- }
+ }
/*
* Get compilation unit source on a file written in UTF-8 charset using UTF-8 encoding for project.
@@ -226,7 +229,7 @@
// Set project encoding
String encoding = "UTF-8";
this.encodingProject.setDefaultCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getSourceModule(utf8File.getFullPath().toString());
String source = utf8Source.getSource();
@@ -242,7 +245,7 @@
for (int i = 0, max = sourceBytes.length; i < max; i++) {
assertTrue("Wrong size of encoded character at " + i, sourceBytes[i] == encodedBytes[i]);
}
- }
+ }
/*
* Get compilation unit source on a file written in UTF-8 charset using workspace default encoding.
@@ -260,7 +263,7 @@
String encodedContents = new String (Util.getResourceContentsAsCharArray(utf8File));
encodedContents = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(encodedContents);
assertEquals("Encoded UTF-8 source should have been decoded the same way!", encodedContents, systemSource);
-
+
// Now compare bytes array
byte[] sourceBytes = source.getBytes(wkspEncoding);
byte[] encodedBytes = Util.getResourceContentsAsByteArray(utf8File);
@@ -283,7 +286,7 @@
// Set file encoding
String encoding = "UTF-8".equals(InterpreterEncoding) ? "Cp1252" : "UTF-8";
utf8File.setCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getSourceModule(utf8File.getFullPath().toString());
String source = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(utf8Source.getSource());
@@ -302,14 +305,14 @@
// Set project encoding
String encoding = "UTF-8".equals(InterpreterEncoding) ? "Cp1252" : "UTF-8";
this.encodingProject.setDefaultCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getSourceModule(utf8File.getFullPath().toString());
String source = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(utf8Source.getSource());
String encodedContents = new String (Util.getResourceContentsAsCharArray(utf8File, InterpreterEncoding));
encodedContents = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(encodedContents);
assertFalse("Sources should not be the same as they were decoded with different encoding!", encodedContents.equals(source));
- }
+ }
/*
* Get compilation unit source on a file written in UTF-8 charset using workspace default encoding.
@@ -339,7 +342,7 @@
// Set file encoding
String encoding = "UTF-8";
utf8File.setCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getClassFile("Encoding" , "bins", "testUTF8", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String source = utf8Source.getSource();
@@ -355,7 +358,7 @@
for (int i = 0, max = sourceBytes.length; i < max; i++) {
assertTrue("Wrong size of encoded character at " + i, sourceBytes[i] == encodedBytes[i]);
}
- }
+ }
private ISourceReference getClassFile(String string, String string2, String string3, String string4) throws ModelException{
return getSourceModule(string, string2, string3+"/"+string4);
@@ -367,7 +370,7 @@
// Set project encoding
String encoding = "UTF-8";
this.encodingProject.setDefaultCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getClassFile("Encoding" , "bins", "testUTF8", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String source = utf8Source.getSource();
@@ -383,7 +386,7 @@
for (int i = 0, max = sourceBytes.length; i < max; i++) {
assertTrue("Wrong size of encoded character at " + i, sourceBytes[i] == encodedBytes[i]);
}
- }
+ }
/* Same config than test003 */
public void test013() throws ModelException, CoreException, UnsupportedEncodingException {
@@ -395,7 +398,7 @@
String encodedContents = new String (Util.getResourceContentsAsCharArray(utf8File));
encodedContents = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(encodedContents);
assertEquals("Encoded UTF-8 source should have been decoded the same way!", encodedContents, systemSource);
-
+
// Now compare bytes array
byte[] sourceBytes = source.getBytes(wkspEncoding);
byte[] encodedBytes = Util.getResourceContentsAsByteArray(utf8File);
@@ -414,7 +417,7 @@
// Set file encoding
String encoding = "UTF-8".equals(InterpreterEncoding) ? "Cp1252" : "UTF-8";
utf8File.setCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getClassFile("Encoding" , "bins", "testUTF8", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String source = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(utf8Source.getSource());
@@ -429,14 +432,14 @@
// Set project encoding
String encoding = "UTF-8".equals(InterpreterEncoding) ? "Cp1252" : "UTF-8";
this.encodingProject.setDefaultCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getClassFile("Encoding" , "bins", "testUTF8", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String source = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(utf8Source.getSource());
String encodedContents = new String (Util.getResourceContentsAsCharArray(utf8File, InterpreterEncoding));
encodedContents = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(encodedContents);
assertFalse("Sources should not be the same as they were decoded with different encoding!", encodedContents.equals(source));
- }
+ }
/* Same config than test006 */
public void test016() throws ModelException, CoreException {
@@ -445,7 +448,7 @@
String encoding = wkspEncoding.equals(InterpreterEncoding) ? ("UTF-8".equals(wkspEncoding) ? "Cp1252" : "UTF-8") : InterpreterEncoding;
// Get source and compare with file contents
- utf8Source = getSourceModule("Encoding" , "bins", "testUTF8/Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ utf8Source = getSourceModule("Encoding" , "bins", "testUTF8/Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String source = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(utf8Source.getSource());
String encodedContents = new String (Util.getResourceContentsAsCharArray(utf8File, encoding));
encodedContents = org.eclipse.dltk.core.tests.util.Util.convertToIndependantLineDelimiter(encodedContents);
@@ -514,7 +517,7 @@
assertNotNull(source);
String encodedContents = new String (Util.getResourceContentsAsCharArray(utf8File, encoding));
assertFalse("Sources should not be the same as they were decoded with different encoding!", encodedContents.equals(source));
-
+
// Reset zip file encoding
zipFile.setCharset(null, null);
}
@@ -533,8 +536,8 @@
"public class Test {}";
IFile file = this.createFile("P/Test.py", initialContent);
file.setCharset(encoding, null);
- ISourceModule cu = this.getSourceModule("P/Test.py");
-
+ ISourceModule cu = this.getSourceModule("P/Test.py");
+
// Modif direct the buffer
String firstModif = "/**\n"+
" * Caract?res exotiques:\n"+
@@ -544,7 +547,7 @@
cu.getBuffer().setContents(firstModif);
cu.getBuffer().save(null, true);
String source = cu.getBuffer().getContents();
-
+
// Compare strings and bytes arrays
String encodedContents = new String (Util.getResourceContentsAsCharArray(file, encoding));
assertEquals("Encoded UTF-8 source should have been decoded the same way!", encodedContents, source);
@@ -579,8 +582,8 @@
"public class Test {}";
IFile file = this.createFile("P/Test.py", initialContent);
file.setCharset(encoding, null);
- ISourceModule cu = this.getSourceModule("P/Test.py");
-
+ ISourceModule cu = this.getSourceModule("P/Test.py");
+
// Modif using working copy
workingCopy = cu.getWorkingCopy(null);
String secondModif = "/**\n"+
@@ -593,7 +596,7 @@
workingCopy.getBuffer().setContents(secondModif);
workingCopy.commitWorkingCopy(true, null);
String source = workingCopy.getBuffer().getContents();
-
+
// Compare strings and bytes arrays
String encodedContents = new String (Util.getResourceContentsAsCharArray(file));
assertEquals("Encoded UTF-8 source should have been decoded the same way!", encodedContents, source);
@@ -622,7 +625,7 @@
// Set file encoding
String encoding = "UTF-8";
utf8File.setCharset(encoding, null);
-
+
// Get source and compare with file contents
utf8Source = getSourceModule(utf8File.getFullPath().toString());
String source = utf8Source.getSource();
@@ -632,8 +635,8 @@
ISourceReference bomSourceRef = getSourceModule(bomFile.getFullPath().toString());
String bomSource = bomSourceRef.getSource();
assertEquals("BOM UTF-8 source should be idtentical than UTF-8!", source, bomSource);
- }
-
+ }
+
//TODO: Source engine
// /*
// * Ensures that a file is reindexed when the encoding changes.
@@ -649,7 +652,7 @@
// IFile file = null;
// try {
// file = createFile(
-// "/Encoding/src/test68585/X.py",
+// "/Encoding/src/test68585/X.py",
// "package test68585;\n" +
// "public class X {\n" +
// "}\n" +
@@ -661,29 +664,29 @@
// }
// file.setCharset(wkspEncoding, null);
// }
-// },
+// },
// null);
-//
+//
// IDLTKSearchScope scope = SearchEngine.createWorkspaceScope();
// DLTKSearchResultCollector resultCollector = new DLTKSearchResultCollector();
// search(
-// "Y\u00F4",
+// "Y\u00F4",
// IDLTKSearchConstants.TYPE,
// IDLTKSearchConstants.DECLARATIONS,
-// scope,
+// scope,
// resultCollector);
// assertSearchResults("Should not get any result", "", resultCollector);
-//
+//
// // change encoding so that file is readable
// getFile("/Encoding/src/test68585/X.py").setCharset(encoding, null);
// search(
-// "Y\u00F4",
+// "Y\u00F4",
// IDLTKSearchConstants.TYPE,
// IDLTKSearchConstants.DECLARATIONS,
-// scope,
+// scope,
// resultCollector);
// assertSearchResults(
-// "Should have been reindexed",
+// "Should have been reindexed",
// "src/test68585/X.py test68585.Y\u00F4 [Y\u00F4]",
// resultCollector);
// } finally {
@@ -705,23 +708,23 @@
ISourceModule cu = getSourceModule(file.getFullPath().toString());
createFolder("/Encoding/src/tmp");
IScriptFolder packFrag = getScriptFolder("Encoding", "src", new Path("tmp"));
-
+
try {
// Move file
cu.move(packFrag, null, null, false, null);
ISourceModule destSource = packFrag.getSourceModule(fileName);
IFile destFile = (IFile) destSource.getUnderlyingResource();
assertEquals("Moved file should keep encoding", encoding, destFile.getCharset());
-
+
// Get source and compare with file contents
compareContents(destSource, encoding);
-
+
// Rename file
destSource.rename("TestUTF8.py", false, null);
ISourceModule renamedSource = packFrag.getSourceModule("TestUTF8.py");
IFile renamedFile = (IFile) renamedSource.getUnderlyingResource();
assertEquals("Moved file should keep encoding", encoding, renamedFile.getCharset());
-
+
// Compare contents again
compareContents(renamedSource, encoding);
}
@@ -731,7 +734,7 @@
//assertEquals("Moved file should keep encoding", encoding, utf8File.getCharset());
deleteFolder("/Encoding/src/tmp");
}
- }
+ }
public void testBug66898b() throws ModelException, CoreException {
// Set file encoding
@@ -742,10 +745,11 @@
final IScriptFolder srcFolder = getScriptFolder("Encoding", "src", "testBug66898b");
createFolder("/Encoding/src/tmp");
final IScriptFolder tmpFolder = getScriptFolder("Encoding", "src", "tmp");
-
+
try {
// Copy file
IWorkspaceRunnable copy = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ISourceModule cu = getSourceModule(file.getFullPath().toString());
cu.copy(tmpFolder, null, null, true, null);
@@ -753,15 +757,16 @@
ISourceModule dest = tmpFolder.getSourceModule(fileName);
IFile destFile = (IFile) dest.getUnderlyingResource();
assertEquals("Copied file should keep encoding", encoding, destFile.getCharset());
-
+
// Get source and compare with file contents
compareContents(dest, encoding);
}
};
DLTKCore.run(copy, null);
-
+
// Rename file
IWorkspaceRunnable rename = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ISourceModule cu = tmpFolder.getSourceModule(fileName);
cu.rename("Renamed.py", true, null);
@@ -769,15 +774,16 @@
ISourceModule ren = tmpFolder.getSourceModule("Renamed.py");
IFile renFile = (IFile) ren.getUnderlyingResource();
assertEquals("Renamed file should keep encoding", encoding, renFile.getCharset());
-
+
// Get source and compare with file contents
compareContents(ren, encoding);
}
};
DLTKCore.run(rename, null);
-
+
// Move file
IWorkspaceRunnable move = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ISourceModule cu = tmpFolder.getSourceModule("Renamed.py");
cu.move(srcFolder, null, null, true, null);
@@ -785,7 +791,7 @@
ISourceModule moved = srcFolder.getSourceModule("Renamed.py");
IFile movedFile = (IFile) moved.getUnderlyingResource();
assertEquals("Renamed file should keep encoding", encoding, movedFile.getCharset());
-
+
// Get source and compare with file contents
compareContents(moved, encoding);
}
@@ -798,7 +804,7 @@
if (cu.exists()) cu.delete(true, null);
deleteFolder("/Encoding/src/tmp");
}
- }
+ }
private IScriptFolder getScriptFolder(String string, String string2, String string3) throws ModelException{
return getScriptFolder(string, string2, new Path(string3));
@@ -821,10 +827,10 @@
// Test read empty content using io file
char[] ifileContents =Util.getResourceContentsAsCharArray(emptyFile, "UTF-8");
assertEquals("We should not get any character!", "", new String(ifileContents));
-
+
// Delete empty file
deleteFile(file.getPath());
- }
+ }
/**
* Bug 110576: [encoding] Rename CU looses encoding for file which charset is determined by contents
@@ -846,14 +852,14 @@
ISourceModule testCU = getSourceModule(file.getFullPath().toString());
createFolder("/Encoding/src/tmp");
IScriptFolder tmpPackage = getScriptFolder("Encoding", "src", new Path("tmp"));
-
+
try {
// Copy file
testCU.copy(tmpPackage, null, null, false, null);
ISourceModule copiedCU = tmpPackage.getSourceModule(fileName);
IFile copiedFile = (IFile) copiedCU.getUnderlyingResource();
verifyUtf8BOM(copiedFile);
-
+
// Get source and compare with file contents
compareContents(copiedCU, "UTF-8", true/*BOM*/);
@@ -863,7 +869,7 @@
IFile renamedFile = (IFile) renamedCU.getUnderlyingResource();
verifyUtf8BOM(renamedFile);
fileName = renamedFile.getName();
-
+
// Compare contents again
compareContents(renamedCU, "UTF-8", true/*BOM*/);
@@ -874,7 +880,7 @@
ISourceModule movedCU = subPackage.getSourceModule(fileName);
IFile movedFile = (IFile) movedCU.getUnderlyingResource();
verifyUtf8BOM(movedFile);
-
+
// Get source and compare with file contents
compareContents(movedCU, "UTF-8", true/*BOM*/);
}
@@ -892,5 +898,5 @@
assertNotNull("File should have a content description", contentDescription);
assertEquals("Content description charset should be UTF-8", "UTF-8", contentDescription.getCharset());
assertNotNull("File should be UTF-8 BOM!", contentDescription.getProperty(IContentDescription.BYTE_ORDER_MARK));
- }
+ }
}
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ExclusionPatternsTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ExclusionPatternsTests.java
index 89ecb32..3698748 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ExclusionPatternsTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ExclusionPatternsTests.java
@@ -1,29 +1,28 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IProjectFragment;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.core.tests.model.ModifyingResourceTests;
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
public class ExclusionPatternsTests extends ModifyingResourceTests {
private static final String[] PYTHON_NATURE = { PythonNature.NATURE_ID };
@@ -35,6 +34,7 @@
protected void setBuildpath(String[] sourceFoldersAndExclusionPatterns) throws ModelException {
this.project.setRawBuildpath(createBuildpath(sourceFoldersAndExclusionPatterns, false/*no inclusion*/, true/*exclusion*/), null);
}
+@Override
protected void setUp() throws Exception {
super.setUp();
this.project = createScriptProject("P", PYTHON_NATURE, new String[] {"src", "bin"});
@@ -53,6 +53,7 @@
return new Suite(ExclusionPatternsTests.class);
}
+@Override
protected void tearDown() throws Exception {
stopDeltas();
deleteProject("P");
@@ -70,23 +71,23 @@
"public class A {\n" +
"}"
);
-
+
clearDeltas();
setBuildpath(new String[] {"/P/src", "**/A.py"});
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
- " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
+ "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
+ " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
" ResourceDelta(/P/.buildpath)[*]"
);
-
+
IScriptFolder pkg = getPackage("/P/src/p");
assertSortedElementsEqual(
"Unexpected children",
"",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"A.py",
@@ -105,20 +106,20 @@
clearDeltas();
scriptProject.setRawBuildpath(createBuildpath(new String[] {"/P1", "doc/"}, false/*no inclusion*/, true/*exclusion*/), null);
//
-
+
assertDeltas(
"Unexpected deltas",
- "P1[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
- " <project root>[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
+ "P1[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
+ " <project root>[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
" ResourceDelta(/P1/.buildpath)[*]"
);
-
+
IProjectFragment root = getProjectFragment("/P1");
assertSortedElementsEqual(
"Unexpected children",
"<default> [in <project root> [in P1]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources of project",
".buildpath\n" +
@@ -132,28 +133,28 @@
/*
* Ensure that adding an exclusion on a package
- * makes it disappear from the children of its package fragment root
+ * makes it disappear from the children of its package fragment root
* and it is added to the non-java resources.
*/
public void testAddExclusionOnPackage() throws CoreException {
createFolder("/P/src/p");
-
+
clearDeltas();
setBuildpath(new String[] {"/P/src", "p/"});
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
- " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
+ "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
+ " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
" ResourceDelta(/P/.buildpath)[*]"
);
-
+
IProjectFragment root = getProjectFragment("/P/src");
assertSortedElementsEqual(
"Unexpected children",
"<default> [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"p",
@@ -171,28 +172,28 @@
"public class A {\n" +
"}"
);
-
+
ISourceModule workingCopy = null;
try {
workingCopy = getSourceModule("/P/src/p/A.py");
workingCopy.becomeWorkingCopy(null, null);
-
+
clearDeltas();
setBuildpath(new String[] {"/P/src", "**/A.py"});
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
- " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
+ "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
+ " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
" ResourceDelta(/P/.buildpath)[*]"
);
-
+
IScriptFolder pkg = getPackage("/P/src/p");
assertSortedElementsEqual(
"Unexpected children",
"",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"A.py",
@@ -209,30 +210,30 @@
*/
public void testAddToExcludedFolder() throws CoreException {
createFolder("/P/src/icons");
-
+
// exclude folder and its contents
setBuildpath(new String[] {"/P/src", "icons/"});
-
+
clearDeltas();
createFile("/P/src/icons/my.txt", "");
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/icons)[*]"
);
-
+
clearDeltas();
deleteFile("/P/src/icons/my.txt");
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/icons)[*]"
);
}
/*
- * Ensure that creating an excluded compilation unit
+ * Ensure that creating an excluded compilation unit
* doesn't make it appear as a child of its package but it is a non-java resource.
*/
public void testCreateExcludedSourceModule() throws CoreException {
@@ -248,48 +249,48 @@
"}",
false,
null);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " p[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/p/A.py)[+]"
);
-
+
assertSortedElementsEqual(
"Unexpected children",
"",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"A.py",
pkg.getForeignResources());
}
/*
- * Ensure that crearing an excluded package
+ * Ensure that crearing an excluded package
* doesn't make it appear as a child of its package fragment root but it is a non-java resource.
*/
public void testCreateExcludedPackage() throws CoreException {
setBuildpath(new String[] {"/P/src", "p/"});
IProjectFragment root = getProjectFragment("/P/src");
-
+
clearDeltas();
root.createScriptFolder("p", false, null);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/p)[+]"
);
-
+
assertSortedElementsEqual(
"Unexpected children",
"<default> [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"p",
@@ -301,24 +302,24 @@
*/
public void testCreateExcludedPackage2() throws CoreException {
setBuildpath(new String[] {"/P/src", "org/*|org/eclipse/*"});
-
+
clearDeltas();
createFolder("/P/src/org/eclipse/mypack");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/org)[+]"
);
-
+
IProjectFragment root = getProjectFragment("/P/src");
assertSortedElementsEqual(
"Unexpected children",
- "<default> [in src [in P]]\n" +
+ "<default> [in src [in P]]\n" +
"org.eclipse.mypack [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"org",
@@ -332,36 +333,36 @@
public void testCreateExcludedAndIncludedPackages() throws CoreException {
setBuildpath(new String[] {"/P/src", "p1/p2/"});
IProjectFragment root = getProjectFragment("/P/src");
-
+
clearDeltas();
createFolder("/P/src/p1/p2");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
" p1[+]: {}"
);
-
+
assertSortedElementsEqual(
"Unexpected children",
- "<default> [in src [in P]]\n" +
+ "<default> [in src [in P]]\n" +
"p1 [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"p2",
root.getScriptFolder("p1").getForeignResources());
}
/*
- * Ensure that creating a file that corresponds to an excluded compilation unit
+ * Ensure that creating a file that corresponds to an excluded compilation unit
* doesn't make it appear as a child of its package but it is a non-java resource.
*/
public void testCreateResourceExcludedSourceModule() throws CoreException {
setBuildpath(new String[] {"/P/src", "**/A.py"});
createFolder("/P/src/p");
-
+
clearDeltas();
createFile(
"/P/src/p/A.py",
@@ -369,49 +370,49 @@
"public class A {\n" +
"}"
);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " p[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/p/A.py)[+]"
);
-
+
IScriptFolder pkg = getPackage("/P/src/p");
assertSortedElementsEqual(
"Unexpected children",
"",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"A.py",
pkg.getForeignResources());
}
/*
- * Ensure that creating a folder that corresponds to an excluded package
+ * Ensure that creating a folder that corresponds to an excluded package
* doesn't make it appear as a child of its package fragment root but it is a non-java resource.
*/
public void testCreateResourceExcludedPackage() throws CoreException {
setBuildpath(new String[] {"/P/src", "p/"});
-
+
clearDeltas();
createFolder("/P/src/p");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CONTENT}\n" +
" ResourceDelta(/P/src/p)[+]"
);
-
+
IProjectFragment root = getProjectFragment("/P/src");
assertSortedElementsEqual(
"Unexpected children",
"<default> [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"p",
@@ -430,7 +431,7 @@
"}"
);
assertTrue("Resource should be on buildpath", project.isOnBuildpath(file));
-
+
ISourceModule cu = getSourceModule("/P/src/p/A.py");
assertTrue("CU should be on buildpath", project.isOnBuildpath(cu));
}
@@ -447,7 +448,7 @@
"}"
);
assertTrue("Resource should not be on buildpath", !project.isOnBuildpath(file));
-
+
ISourceModule cu = getSourceModule("/P/src/p/A.py");
assertTrue("CU should not be on buildpath", !project.isOnBuildpath(cu));
}
@@ -472,7 +473,7 @@
/*
* Ensures that an excluded nested source folder doesn't appear as a non-java resource of the outer folder.
* (regression test for bug 28115 Ubiquitous resource in the ScriptModel)
- *
+ *
*/
public void testNestedSourceFolder1() throws CoreException {
setBuildpath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
@@ -484,79 +485,79 @@
root1.getForeignResources());
}
/*
- * Ensures that adding a .py file in a nested source folder reports
+ * Ensures that adding a .py file in a nested source folder reports
* a delta on the nested source folder and not on the outer one.
*/
public void testNestedSourceFolder2() throws CoreException {
setBuildpath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
createFolder("/P/src1/src2");
-
+
clearDeltas();
createFile(
"/P/src1/src2/A.py",
"public class A {\n" +
"}"
);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1/src2[*]: {CHILDREN}\n" +
- " <default>[*]: {CHILDREN}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src1/src2[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
" A.py[+]: {}"
);
}
/*
- * Ensures that adding a .txt file in a nested source folder reports
+ * Ensures that adding a .txt file in a nested source folder reports
* a resource delta on the nested source folder and not on the outer one.
*/
public void testNestedSourceFolder3() throws CoreException {
setBuildpath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
createFolder("/P/src1/src2");
-
+
clearDeltas();
createFile("/P/src1/src2/readme.txt", "");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1/src2[*]: {CONTENT}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src1/src2[*]: {CONTENT}\n" +
" ResourceDelta(/P/src1/src2/readme.txt)[+]"
);
}
/*
- * Ensures that adding a folder in a nested source folder reports
+ * Ensures that adding a folder in a nested source folder reports
* a delta on the nested source folder and not on the outer one.
*/
public void testNestedSourceFolder4() throws CoreException {
setBuildpath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
createFolder("/P/src1/src2");
-
+
clearDeltas();
createFolder("/P/src1/src2/p");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1/src2[*]: {CHILDREN}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src1/src2[*]: {CHILDREN}\n" +
" p[+]: {}"
);
}
/*
- * Ensures that adding a folder in a outer source folder reports
+ * Ensures that adding a folder in a outer source folder reports
* a delta on the outer source folder and not on the nested one.
*/
public void testNestedSourceFolder5() throws CoreException {
setBuildpath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
createFolder("/P/src1/src2");
-
+
clearDeltas();
createFolder("/P/src1/p");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1[*]: {CHILDREN}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src1[*]: {CHILDREN}\n" +
" p[+]: {}"
);
}
@@ -568,16 +569,16 @@
setBuildpath(new String[] {"/P/src1", "src2/**", "/P/src1/src2", ""});
createFolder("/P/src1/src2");
createFolder("/P/src1/p");
-
+
clearDeltas();
moveFolder("/P/src1/p", "/P/src1/src2/p");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src1[*]: {CHILDREN}\n" +
- " p[-]: {MOVED_TO(p [in src1/src2 [in P]])}\n" +
- " src1/src2[*]: {CHILDREN}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src1[*]: {CHILDREN}\n" +
+ " p[-]: {MOVED_TO(p [in src1/src2 [in P]])}\n" +
+ " src1/src2[*]: {CHILDREN}\n" +
" p[+]: {MOVED_FROM(p [in src1 [in P]])}"
);
}
@@ -597,22 +598,22 @@
clearDeltas();
file.move(new Path("/P/src/p/B.py"), false, null);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CHILDREN | CONTENT}\n" +
- " B.py[+]: {}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " p[*]: {CHILDREN | CONTENT}\n" +
+ " B.py[+]: {}\n" +
" ResourceDelta(/P/src/p/A.py)[-]"
);
-
+
IScriptFolder pkg = getPackage("/P/src/p");
assertSortedElementsEqual(
"Unexpected children",
"B.py [in p [in src [in P]]]",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
@@ -620,31 +621,31 @@
}
/*
* Ensure that renaming an excluded package so that it is not excluded any longer
- * makes it appears as a child of its package fragment root
+ * makes it appears as a child of its package fragment root
* and it is removed from the non-java resources.
*/
public void testRenameExcludedPackage() throws CoreException {
setBuildpath(new String[] {"/P/src", "p/"});
IProjectFragment root = getProjectFragment("/P/src");
IScriptFolder pkg = root.createScriptFolder("p", false, null);
-
+
clearDeltas();
pkg.getResource().move(new Path("/P/src/q"), false, null);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN | CONTENT}\n" +
- " q[+]: {}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN | CONTENT}\n" +
+ " q[+]: {}\n" +
" ResourceDelta(/P/src/p)[-]"
);
-
+
assertSortedElementsEqual(
"Unexpected children",
- "<default> [in src [in P]]\n" +
+ "<default> [in src [in P]]\n" +
"q [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
@@ -663,25 +664,25 @@
"public class A {\n" +
"}"
);
-
+
clearDeltas();
file.move(new Path("/P/src/p/B.py"), false, null);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
- " p[*]: {CHILDREN | CONTENT}\n" +
- " B.py[+]: {}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " p[*]: {CHILDREN | CONTENT}\n" +
+ " B.py[+]: {}\n" +
" ResourceDelta(/P/src/p/A.py)[-]"
);
-
+
IScriptFolder pkg = getPackage("/P/src/p");
assertSortedElementsEqual(
"Unexpected children",
"B.py [in p [in src [in P]]]",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
@@ -701,10 +702,10 @@
// );
// ModelSearchTests.ModelSearchResultCollector resultCollector = new ModelSearchTests.ModelSearchResultCollector();
// search(
-// "A",
+// "A",
// IDLTKSearchConstants.TYPE,
// IDLTKSearchConstants.DECLARATIONS,
-// SearchEngine.createModelSearchScope(new IScriptProject[] {getScriptProject("P")}),
+// SearchEngine.createModelSearchScope(new IScriptProject[] {getScriptProject("P")}),
// resultCollector);
// assertEquals(
// "Unexpected matches found",
@@ -723,14 +724,14 @@
// "public class A {\n" +
// "}"
// );
-//
+//
// setBuildpath(new String[] {"/P/src", ""});
// ModelSearchTests.ModelSearchResultCollector resultCollector = new ModelSearchTests.ModelSearchResultCollector();
// search(
-// "A",
+// "A",
// IModelSearchConstants.TYPE,
// IModelSearchConstants.DECLARATIONS,
-// SearchEngine.createModelSearchScope(new IScriptProject[] {getScriptProject("P")}),
+// SearchEngine.createModelSearchScope(new IScriptProject[] {getScriptProject("P")}),
// resultCollector);
// assertEquals(
// "Unexpected matches found",
@@ -746,22 +747,22 @@
setBuildpath(new String[] {"/P/src", "p1/p2/"});
IProjectFragment root = getProjectFragment("/P/src");
createFolder("/P/src/p1/p2");
-
+
clearDeltas();
deleteFolder("/P/src/p1");
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
" p1[-]: {}"
);
-
+
assertSortedElementsEqual(
"Unexpected children",
"<default> [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
@@ -769,33 +770,33 @@
}
/*
- * Ensure that renaming a folder that corresponds to an excluded package
+ * Ensure that renaming a folder that corresponds to an excluded package
* so that it is not excluded any longer
- * makes it appears as a child of its package fragment root
+ * makes it appears as a child of its package fragment root
* and it is removed from the non-java resources.
*/
public void testRenameResourceExcludedPackage() throws CoreException {
setBuildpath(new String[] {"/P/src", "p/"});
IFolder folder = createFolder("/P/src/p");
-
+
clearDeltas();
folder.move(new Path("/P/src/q"), false, null);
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN}\n" +
- " src[*]: {CHILDREN | CONTENT}\n" +
- " q[+]: {}\n" +
+ "P[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN | CONTENT}\n" +
+ " q[+]: {}\n" +
" ResourceDelta(/P/src/p)[-]"
);
-
+
IProjectFragment root = getProjectFragment("/P/src");
assertSortedElementsEqual(
"Unexpected children",
- "<default> [in src [in P]]\n" +
+ "<default> [in src [in P]]\n" +
"q [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
@@ -819,14 +820,14 @@
// );
// }
// }, null);
-//
+//
// ModelSearchTests.ModelSearchResultCollector resultCollector = new ModelSearchTests.ModelSearchResultCollector();
// IModelSearchScope scope = SearchEngine.createModelSearchScope(new IModelElement[] {getScriptProject("P")});
// search(
-// "X",
+// "X",
// IModelSearchConstants.TYPE,
// IModelSearchConstants.DECLARATIONS,
-// scope,
+// scope,
// resultCollector);
// assertEquals("", resultCollector.toString());
// } finally {
@@ -846,23 +847,23 @@
"public class A {\n" +
"}"
);
-
+
clearDeltas();
setBuildpath(new String[] {"/P/src", ""});
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
- " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
+ "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
+ " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
" ResourceDelta(/P/.classpath)[*]"
);
-
+
IScriptFolder pkg = getPackage("/P/src/p");
assertSortedElementsEqual(
"Unexpected children",
"A.py [in p [in src [in P]]]",
pkg.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
@@ -870,30 +871,30 @@
}
/*
* Ensure that removing the exclusion on a package
- * makes it appears as a child of its package fragment root
+ * makes it appears as a child of its package fragment root
* and it is removed from the non-java resources.
*/
public void testRemoveExclusionOnPackage() throws CoreException {
setBuildpath(new String[] {"/P/src", "p"});
createFolder("/P/src/p");
-
+
clearDeltas();
setBuildpath(new String[] {"/P/src", ""});
-
+
assertDeltas(
"Unexpected deltas",
- "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
- " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
+ "P[*]: {CHILDREN | BUILDPATH CHANGED}\n" +
+ " src[*]: {ADDED TO BUILDPATH | REMOVED FROM BUILDPATH}\n" +
" ResourceDelta(/P/.classpath)[*]"
);
-
+
IProjectFragment root = getProjectFragment("/P/src");
assertSortedElementsEqual(
"Unexpected children",
- "<default> [in src [in P]]\n" +
+ "<default> [in src [in P]]\n" +
"p [in src [in P]]",
root.getChildren());
-
+
assertResourceNamesEqual(
"Unexpected non-java resources",
"",
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests0.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests0.java
index ab687b4..ad0063b 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests0.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests0.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests0 extends AbstractModelTests
{
public GeneratedModelTests0(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests0.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_0", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_0" );
@@ -44,7 +48,7 @@
assertNotNull("Module test_socketserver.py not found", module);
assertEquals("test_socketserver.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "NREQ");
@@ -244,7 +248,7 @@
assertNotNull("Module test_dict.py not found", module);
assertEquals("test_dict.py", module.getElementName());
-
+
//Class test
{
IType classDictTest0;
@@ -777,7 +781,7 @@
assertNotNull("Module test_dumbdbm.py not found", module);
assertEquals("test_dumbdbm.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "_fname");
@@ -904,7 +908,7 @@
assertNotNull("Module test_generators.py not found", module);
assertEquals("test_generators.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "tutorial_tests");
@@ -1123,7 +1127,7 @@
assertNotNull("Module test_binhex.py not found", module);
assertEquals("test_binhex.py", module.getElementName());
-
+
//Class test
{
IType classBinHexTestCase0;
@@ -1170,7 +1174,7 @@
assertNotNull("Module test_repr.py not found", module);
assertEquals("test_repr.py", module.getElementName());
-
+
//Function test:nestedTuple
{
IMethod methodnestedTuple0;
@@ -1412,7 +1416,7 @@
assertNotNull("Module test_binop.py not found", module);
assertEquals("test_binop.py", module.getElementName());
-
+
//Function test:gcd
{
IMethod methodgcd0;
@@ -1717,7 +1721,7 @@
assertNotNull("Module test_unary.py not found", module);
assertEquals("test_unary.py", module.getElementName());
-
+
//Class test
{
IType classUnaryOpTestCase0;
@@ -1781,7 +1785,7 @@
assertNotNull("Module test_atexit.py not found", module);
assertEquals("test_atexit.py", module.getElementName());
-
+
//Class test
{
IType classTestCase0;
@@ -1873,7 +1877,7 @@
assertNotNull("Module test_parser.py not found", module);
assertEquals("test_parser.py", module.getElementName());
-
+
//Class test
{
IType classRoundtripLegalSyntaxTestCase0;
@@ -2055,7 +2059,7 @@
assertNotNull("Module test_StringIO.py not found", module);
assertEquals("test_StringIO.py", module.getElementName());
-
+
//Class test
{
IType classTestGenericStringIO0;
@@ -2185,7 +2189,7 @@
assertNotNull("Module test_cmath.py not found", module);
assertEquals("test_cmath.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "testdict");
@@ -2215,7 +2219,7 @@
assertNotNull("Module test_htmlparser.py not found", module);
assertEquals("test_htmlparser.py", module.getElementName());
-
+
//Class test
{
IType classEventCollector0;
@@ -2507,7 +2511,7 @@
assertNotNull("Module testcodec.py not found", module);
assertEquals("testcodec.py", module.getElementName());
-
+
//Class test
{
IType classCodec0;
@@ -2563,7 +2567,7 @@
assertNotNull("Module pickletester.py not found", module);
assertEquals("pickletester.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "protocols");
@@ -3222,7 +3226,7 @@
assertNotNull("Module test_al.py not found", module);
assertEquals("test_al.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "alattrs");
@@ -3242,7 +3246,7 @@
assertNotNull("Module test_cd.py not found", module);
assertEquals("test_cd.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "cdattrs");
@@ -3262,7 +3266,7 @@
assertNotNull("Module test_cl.py not found", module);
assertEquals("test_cl.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "clattrs");
@@ -3282,7 +3286,7 @@
assertNotNull("Module test_dl.py not found", module);
assertEquals("test_dl.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "sharedlibs");
@@ -3300,7 +3304,7 @@
assertNotNull("Module test_select.py not found", module);
assertEquals("test_select.py", module.getElementName());
-
+
//Class test
{
IType classNope0;
@@ -3335,7 +3339,7 @@
assertNotNull("Module test_gc.py not found", module);
assertEquals("test_gc.py", module.getElementName());
-
+
//Function test:expect
{
IMethod methodexpect0;
@@ -3784,7 +3788,7 @@
assertNotNull("Module test_string.py not found", module);
assertEquals("test_string.py", module.getElementName());
-
+
//Class test
{
IType classStringTest0;
@@ -3886,7 +3890,7 @@
assertNotNull("Module test_gl.py not found", module);
assertEquals("test_gl.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "glattrs");
@@ -3906,7 +3910,7 @@
assertNotNull("Module test_doctest2.py not found", module);
assertEquals("test_doctest2.py", module.getElementName());
-
+
//Class test
{
IType classC0;
@@ -3994,7 +3998,7 @@
assertNotNull("Module test_normalization.py not found", module);
assertEquals("test_normalization.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TESTDATAFILE");
@@ -4067,7 +4071,7 @@
assertNotNull("Module test_commands.py not found", module);
assertEquals("test_commands.py", module.getElementName());
-
+
//Class test
{
IType classCommandTests0;
@@ -4103,7 +4107,7 @@
assertNotNull("Module test_openpty.py not found", module);
assertEquals("test_openpty.py", module.getElementName());
-
+
}
public void testModelGen27( ) throws Exception {
@@ -4113,7 +4117,7 @@
assertNotNull("Module test_enumerate.py not found", module);
assertEquals("test_enumerate.py", module.getElementName());
-
+
//Class test
{
IType classG0;
@@ -4474,7 +4478,7 @@
assertNotNull("Module test_os.py not found", module);
assertEquals("test_os.py", module.getElementName());
-
+
//Class test
{
IType classTemporaryFileTests0;
@@ -4676,7 +4680,7 @@
assertNotNull("Module test_profilehooks.py not found", module);
assertEquals("test_profilehooks.py", module.getElementName());
-
+
//Class test
{
IType classHookWatcher0;
@@ -5161,7 +5165,7 @@
assertNotNull("Module test_re.py not found", module);
assertEquals("test_re.py", module.getElementName());
-
+
//Class test
{
IType classReTests0;
@@ -5615,7 +5619,7 @@
assertNotNull("Module test_ossaudiodev.py not found", module);
assertEquals("test_ossaudiodev.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "AFMT_S16_NE");
@@ -5671,7 +5675,7 @@
assertNotNull("Module test_uu.py not found", module);
assertEquals("test_uu.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "plaintext");
@@ -5815,7 +5819,7 @@
assertNotNull("Module test_audioop.py not found", module);
assertEquals("test_audioop.py", module.getElementName());
-
+
//Function test:gendata1
{
IMethod methodgendata10;
@@ -6017,7 +6021,7 @@
assertNotNull("Module test_crypt.py not found", module);
assertEquals("test_crypt.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "c");
@@ -6031,7 +6035,7 @@
assertNotNull("Module test_linuxaudiodev.py not found", module);
assertEquals("test_linuxaudiodev.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "SND_FORMAT_MULAW_8");
@@ -6064,7 +6068,7 @@
assertNotNull("Module test_compiler.py not found", module);
assertEquals("test_compiler.py", module.getElementName());
-
+
//Class test
{
IType classCompilerTest0;
@@ -6136,7 +6140,7 @@
assertNotNull("Module test_shlex.py not found", module);
assertEquals("test_shlex.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "data");
@@ -6201,7 +6205,7 @@
assertNotNull("Module testall.py not found", module);
assertEquals("testall.py", module.getElementName());
-
+
}
public void testModelGen39( ) throws Exception {
@@ -6211,7 +6215,7 @@
assertNotNull("Module test_xpickle.py not found", module);
assertEquals("test_xpickle.py", module.getElementName());
-
+
//Class test
{
IType classDumpCPickle_LoadPickle0;
@@ -6275,7 +6279,7 @@
assertNotNull("Module test_scriptpackages.py not found", module);
assertEquals("test_scriptpackages.py", module.getElementName());
-
+
//Class test
{
IType classTestScriptpackages0;
@@ -6360,7 +6364,7 @@
assertNotNull("Module test_unpack.py not found", module);
assertEquals("test_unpack.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "doctests");
@@ -6385,7 +6389,7 @@
assertNotNull("Module test_email_codecs.py not found", module);
assertEquals("test_email_codecs.py", module.getElementName());
-
+
}
public void testModelGen43( ) throws Exception {
@@ -6395,7 +6399,7 @@
assertNotNull("Module test_rfc822.py not found", module);
assertEquals("test_rfc822.py", module.getElementName());
-
+
//Class test
{
IType classMessageTestCase0;
@@ -6522,7 +6526,7 @@
assertNotNull("Module test_long_future.py not found", module);
assertEquals("test_long_future.py", module.getElementName());
-
+
//Function test:test_true_division
{
IMethod methodtest_true_division0;
@@ -6538,7 +6542,7 @@
assertNotNull("Module test_dircache.py not found", module);
assertEquals("test_dircache.py", module.getElementName());
-
+
//Class test
{
IType classDircacheTests0;
@@ -6609,7 +6613,7 @@
assertNotNull("Module test_multibytecodec.py not found", module);
assertEquals("test_multibytecodec.py", module.getElementName());
-
+
//Class test
{
IType classTest_StreamWriter0;
@@ -6666,7 +6670,7 @@
assertNotNull("Module test_frozen.py not found", module);
assertEquals("test_frozen.py", module.getElementName());
-
+
}
public void testModelGen48( ) throws Exception {
@@ -6676,7 +6680,7 @@
assertNotNull("Module test_urllib.py not found", module);
assertEquals("test_urllib.py", module.getElementName());
-
+
//Function test:hexescape
{
IMethod methodhexescape0;
@@ -7033,7 +7037,7 @@
assertNotNull("Module mapping_tests.py not found", module);
assertEquals("mapping_tests.py", module.getElementName());
-
+
//Class test
{
IType classBasicTestMappingProtocol0;
@@ -7746,4 +7750,3 @@
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests1.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests1.java
index 7a085bc..80cf24a 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests1.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests1.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests1 extends AbstractModelTests
{
public GeneratedModelTests1(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests1.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_1", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_1" );
@@ -44,7 +48,7 @@
assertNotNull("Module test_codecmaps_cn.py not found", module);
assertEquals("test_codecmaps_cn.py", module.getElementName());
-
+
//Class test
{
IType classTestGB2312Map0;
@@ -96,7 +100,7 @@
assertNotNull("Module test_whichdb.py not found", module);
assertEquals("test_whichdb.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "_fname");
@@ -160,7 +164,7 @@
assertNotNull("Module test_unicode.py not found", module);
assertEquals("test_unicode.py", module.getElementName());
-
+
//Class test
{
IType classUnicodeTest0;
@@ -545,7 +549,7 @@
assertNotNull("Module test_codecmaps_hk.py not found", module);
assertEquals("test_codecmaps_hk.py", module.getElementName());
-
+
//Class test
{
IType classTestBig5HKSCSMap0;
@@ -579,7 +583,7 @@
assertNotNull("Module sortperf.py not found", module);
assertEquals("sortperf.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "td");
@@ -626,7 +630,7 @@
assertNotNull("Module test_resource.py not found", module);
assertEquals("test_resource.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "limit_set");
@@ -652,7 +656,7 @@
assertNotNull("Module test_codecmaps_jp.py not found", module);
assertEquals("test_codecmaps_jp.py", module.getElementName());
-
+
//Class test
{
IType classTestCP932Map0;
@@ -770,7 +774,7 @@
assertNotNull("Module test_codecmaps_kr.py not found", module);
assertEquals("test_codecmaps_kr.py", module.getElementName());
-
+
//Class test
{
IType classTestCP949Map0;
@@ -848,7 +852,7 @@
assertNotNull("Module test_threading.py not found", module);
assertEquals("test_threading.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "numtasks");
@@ -897,7 +901,7 @@
assertNotNull("Module test_quopri.py not found", module);
assertEquals("test_quopri.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "ENCSAMPLE");
@@ -995,7 +999,7 @@
assertNotNull("Module test_applesingle.py not found", module);
assertEquals("test_applesingle.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "AS_MAGIC");
@@ -1076,7 +1080,7 @@
assertNotNull("Module test_sets.py not found", module);
assertEquals("test_sets.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "empty_set");
@@ -2202,7 +2206,7 @@
assertNotNull("Module test_codecmaps_tw.py not found", module);
assertEquals("test_codecmaps_tw.py", module.getElementName());
-
+
//Class test
{
IType classTestBIG5Map0;
@@ -2258,7 +2262,7 @@
assertNotNull("Module test_pyclbr.py not found", module);
assertEquals("test_pyclbr.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "StaticMethodType");
@@ -2358,7 +2362,7 @@
assertNotNull("Module reperf.py not found", module);
assertEquals("reperf.py", module.getElementName());
-
+
//Function test:main
{
IMethod methodmain0;
@@ -2381,7 +2385,7 @@
assertNotNull("Module test_winreg.py not found", module);
assertEquals("test_winreg.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "test_key_name");
@@ -2443,7 +2447,7 @@
assertNotNull("Module test_userdict.py not found", module);
assertEquals("test_userdict.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "d0");
@@ -2602,7 +2606,7 @@
assertNotNull("Module test_dummy_thread.py not found", module);
assertEquals("test_dummy_thread.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "DELAY");
@@ -2780,7 +2784,7 @@
assertNotNull("Module test_errno.py not found", module);
assertEquals("test_errno.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "errors");
@@ -2798,7 +2802,7 @@
assertNotNull("Module test_bsddb185.py not found", module);
assertEquals("test_bsddb185.py", module.getElementName());
-
+
//Class test
{
IType classBsddb185Tests0;
@@ -2841,7 +2845,7 @@
assertNotNull("Module test_doctest.py not found", module);
assertEquals("test_doctest.py", module.getElementName());
-
+
//Function test:sample_func
{
IMethod methodsample_func0;
@@ -3136,7 +3140,7 @@
assertNotNull("Module test_list.py not found", module);
assertEquals("test_list.py", module.getElementName());
-
+
//Class test
{
IType classListTest0;
@@ -3184,7 +3188,7 @@
assertNotNull("Module test_pep247.py not found", module);
assertEquals("test_pep247.py", module.getElementName());
-
+
//Function test:check_hash_module
{
IMethod methodcheck_hash_module0;
@@ -3201,7 +3205,7 @@
assertNotNull("Module test_struct.py not found", module);
assertEquals("test_struct.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "ISBIGENDIAN");
@@ -3380,7 +3384,7 @@
assertNotNull("Module test_pep263.py not found", module);
assertEquals("test_pep263.py", module.getElementName());
-
+
//Class test
{
IType classPEP263Test0;
@@ -3409,7 +3413,7 @@
assertNotNull("Module double_const.py not found", module);
assertEquals("double_const.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "PI");
@@ -3442,7 +3446,7 @@
assertNotNull("Module test_pep277.py not found", module);
assertEquals("test_pep277.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "filenames");
@@ -3535,7 +3539,7 @@
assertNotNull("Module test_zipfile.py not found", module);
assertEquals("test_zipfile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "zlib");
@@ -3627,7 +3631,7 @@
assertNotNull("Module test_pep292.py not found", module);
assertEquals("test_pep292.py", module.getElementName());
-
+
//Class test
{
IType classBag0;
@@ -3796,7 +3800,7 @@
assertNotNull("Module test_imageop.py not found", module);
assertEquals("test_imageop.py", module.getElementName());
-
+
//Function test:main
{
IMethod methodmain0;
@@ -3834,7 +3838,7 @@
assertNotNull("Module test_transformer.py not found", module);
assertEquals("test_transformer.py", module.getElementName());
-
+
//Class test
{
IType classTests0;
@@ -3863,7 +3867,7 @@
assertNotNull("Module test_email.py not found", module);
assertEquals("test_email.py", module.getElementName());
-
+
//Function test:test_main
{
IMethod methodtest_main0;
@@ -3879,7 +3883,7 @@
assertNotNull("Module test_importhooks.py not found", module);
assertEquals("test_importhooks.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "test_src");
@@ -4127,7 +4131,7 @@
assertNotNull("Module test_types.py not found", module);
assertEquals("test_types.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4225,7 +4229,7 @@
assertNotNull("Module test_timing.py not found", module);
assertEquals("test_timing.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "r");
@@ -4251,7 +4255,7 @@
assertNotNull("Module test_site.py not found", module);
assertEquals("test_site.py", module.getElementName());
-
+
//Class test
{
IType classHelperFunctionsTests0;
@@ -4432,7 +4436,7 @@
assertNotNull("Module cjkencodings_test.py not found", module);
assertEquals("cjkencodings_test.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "teststring");
@@ -4446,7 +4450,7 @@
assertNotNull("Module autotest.py not found", module);
assertEquals("autotest.py", module.getElementName());
-
+
}
public void testModelGen88( ) throws Exception {
@@ -4456,7 +4460,7 @@
assertNotNull("Module test_profile.py not found", module);
assertEquals("test_profile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "ticks");
@@ -4537,7 +4541,7 @@
assertNotNull("Module sample_doctest.py not found", module);
assertEquals("sample_doctest.py", module.getElementName());
-
+
//Function test:foo
{
IMethod methodfoo0;
@@ -4597,7 +4601,7 @@
assertNotNull("Module test_math.py not found", module);
assertEquals("test_math.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "seps");
@@ -4642,7 +4646,7 @@
assertNotNull("Module test_softspace.py not found", module);
assertEquals("test_softspace.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "f");
@@ -4669,7 +4673,7 @@
assertNotNull("Module pyclbr_input.py not found", module);
assertEquals("pyclbr_input.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4757,7 +4761,7 @@
assertNotNull("Module test_colorsys.py not found", module);
assertEquals("test_colorsys.py", module.getElementName());
-
+
//Function test:frange
{
IMethod methodfrange0;
@@ -4821,7 +4825,7 @@
assertNotNull("Module test_zlib.py not found", module);
assertEquals("test_zlib.py", module.getElementName());
-
+
//Function test:getbuf
{
IMethod methodgetbuf0;
@@ -5057,7 +5061,7 @@
assertNotNull("Module test_aepack.py not found", module);
assertEquals("test_aepack.py", module.getElementName());
-
+
//Class test
{
IType classTestAepack0;
@@ -5132,7 +5136,7 @@
assertNotNull("Module test_long.py not found", module);
assertEquals("test_long.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "SHIFT");
@@ -5332,7 +5336,7 @@
assertNotNull("Module test_macfs.py not found", module);
assertEquals("test_macfs.py", module.getElementName());
-
+
//Class test
{
IType classTestMacfs0;
@@ -5424,7 +5428,7 @@
assertNotNull("Module test_optparse.py not found", module);
assertEquals("test_optparse.py", module.getElementName());
-
+
//Class test
{
IType classInterceptedError0;
@@ -7081,7 +7085,7 @@
assertNotNull("Module test_fpformat.py not found", module);
assertEquals("test_fpformat.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "StringType");
@@ -7137,4 +7141,3 @@
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests2.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests2.java
index 912781d..b437ed3 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests2.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests2.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests2 extends AbstractModelTests
{
public GeneratedModelTests2(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests2.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_2", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_2" );
@@ -44,7 +48,7 @@
assertNotNull("Module test_xrange.py not found", module);
assertEquals("test_xrange.py", module.getElementName());
-
+
//Class test
{
IType classXrangeTest0;
@@ -73,7 +77,7 @@
assertNotNull("Module test_compare.py not found", module);
assertEquals("test_compare.py", module.getElementName());
-
+
//Class test
{
IType classEmpty0;
@@ -160,7 +164,7 @@
assertNotNull("Module test_thread.py not found", module);
assertEquals("test_thread.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "mutex");
@@ -246,7 +250,7 @@
assertNotNull("Module test_codeccallbacks.py not found", module);
assertEquals("test_codeccallbacks.py", module.getElementName());
-
+
//Class test
{
IType classPosReturn0;
@@ -586,7 +590,7 @@
assertNotNull("Module test_rgbimg.py not found", module);
assertEquals("test_rgbimg.py", module.getElementName());
-
+
//Class test
{
IType classerror0;
@@ -637,7 +641,7 @@
assertNotNull("Module tf_inherit_check.py not found", module);
assertEquals("tf_inherit_check.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "verbose");
@@ -655,7 +659,7 @@
assertNotNull("Module test_sort.py not found", module);
assertEquals("test_sort.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "nerrors");
@@ -996,7 +1000,7 @@
assertNotNull("Module test_file.py not found", module);
assertEquals("test_file.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "f");
@@ -1114,7 +1118,7 @@
assertNotNull("Module seq_tests.py not found", module);
assertEquals("seq_tests.py", module.getElementName());
-
+
//Class test
{
IType classCommonTest0;
@@ -1271,7 +1275,7 @@
assertNotNull("Module test_isinstance.py not found", module);
assertEquals("test_isinstance.py", module.getElementName());
-
+
//Class test
{
IType classTestIsInstanceExceptions0;
@@ -1683,7 +1687,7 @@
assertNotNull("Module test_sunaudiodev.py not found", module);
assertEquals("test_sunaudiodev.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "audiodev");
@@ -1714,7 +1718,7 @@
assertNotNull("Module test_fork1.py not found", module);
assertEquals("test_fork1.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "LONGSLEEP");
@@ -1757,7 +1761,7 @@
assertNotNull("Module test_datetime.py not found", module);
assertEquals("test_datetime.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "pickle_choices");
@@ -3647,7 +3651,7 @@
assertNotNull("Module test_urllib2net.py not found", module);
assertEquals("test_urllib2net.py", module.getElementName());
-
+
//Class test
{
IType classURLTimeoutTest0;
@@ -3728,7 +3732,7 @@
assertNotNull("Module test_hotshot.py not found", module);
assertEquals("test_hotshot.py", module.getElementName());
-
+
//Function test:shortfilename
{
IMethod methodshortfilename0;
@@ -3852,7 +3856,7 @@
assertNotNull("Module test_bsddb.py not found", module);
assertEquals("test_bsddb.py", module.getElementName());
-
+
//Class test
{
IType classTestBSDDB0;
@@ -4099,7 +4103,7 @@
assertNotNull("Module test_peepholer.py not found", module);
assertEquals("test_peepholer.py", module.getElementName());
-
+
//Function test:disassemble
{
IMethod methoddisassemble0;
@@ -4218,7 +4222,7 @@
assertNotNull("Module test_sgmllib.py not found", module);
assertEquals("test_sgmllib.py", module.getElementName());
-
+
//Class test
{
IType classEventCollector0;
@@ -4522,7 +4526,7 @@
assertNotNull("Module test_threadsignals.py not found", module);
assertEquals("test_threadsignals.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "process_pid");
@@ -4586,7 +4590,7 @@
assertNotNull("Module test_cookie.py not found", module);
assertEquals("test_cookie.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "cases");
@@ -4612,7 +4616,7 @@
assertNotNull("Module test_iterlen.py not found", module);
assertEquals("test_iterlen.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "n");
@@ -4873,7 +4877,7 @@
assertNotNull("Module test_time.py not found", module);
assertEquals("test_time.py", module.getElementName());
-
+
//Class test
{
IType classTimeTestCase0;
@@ -4993,7 +4997,7 @@
assertNotNull("Module test_userlist.py not found", module);
assertEquals("test_userlist.py", module.getElementName());
-
+
//Class test
{
IType classUserListTest0;
@@ -5081,7 +5085,7 @@
assertNotNull("Module test_zipimport.py not found", module);
assertEquals("test_zipimport.py", module.getElementName());
-
+
//Function test:make_pyc
{
IMethod methodmake_pyc0;
@@ -5261,7 +5265,7 @@
assertNotNull("Module test_tarfile.py not found", module);
assertEquals("test_tarfile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "gzip");
@@ -5689,7 +5693,7 @@
assertNotNull("Module test_socket_ssl.py not found", module);
assertEquals("test_socket_ssl.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "skip_expected");
@@ -5733,7 +5737,7 @@
assertNotNull("Module test_shutil.py not found", module);
assertEquals("test_shutil.py", module.getElementName());
-
+
//Class test
{
IType classTestShutil0;
@@ -5797,7 +5801,7 @@
assertNotNull("Module test_popen.py not found", module);
assertEquals("test_popen.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "python");
@@ -5834,7 +5838,7 @@
assertNotNull("Module test_extcall.py not found", module);
assertEquals("test_extcall.py", module.getElementName());
-
+
//Function test:e
{
IMethod methode0;
@@ -6045,7 +6049,7 @@
assertNotNull("Module test_mmap.py not found", module);
assertEquals("test_mmap.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "PAGESIZE");
@@ -6065,7 +6069,7 @@
assertNotNull("Module test_threaded_import.py not found", module);
assertEquals("test_threaded_import.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "critical_section");
@@ -6095,7 +6099,7 @@
assertNotNull("Module test_asynchat.py not found", module);
assertEquals("test_asynchat.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "HOST");
@@ -6166,7 +6170,7 @@
assertNotNull("Module test_compile.py not found", module);
assertEquals("test_compile.py", module.getElementName());
-
+
//Class test
{
IType classTestSpecifics0;
@@ -6373,7 +6377,7 @@
assertNotNull("Module test_pkgimport.py not found", module);
assertEquals("test_pkgimport.py", module.getElementName());
-
+
//Class test
{
IType classTestImport0;
@@ -6437,7 +6441,7 @@
assertNotNull("Module test_gdbm.py not found", module);
assertEquals("test_gdbm.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "filename");
@@ -6475,7 +6479,7 @@
assertNotNull("Module test_random.py not found", module);
assertEquals("test_random.py", module.getElementName());
-
+
//Class test
{
IType classTestBasicOps0;
@@ -6845,7 +6849,7 @@
assertNotNull("Module test___all__.py not found", module);
assertEquals("test___all__.py", module.getElementName());
-
+
//Class test
{
IType classAllTest0;
@@ -6881,7 +6885,7 @@
assertNotNull("Module test_tokenize.py not found", module);
assertEquals("test_tokenize.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "f");
@@ -6895,7 +6899,7 @@
assertNotNull("Module test_mhlib.py not found", module);
assertEquals("test_mhlib.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "_mhroot");
@@ -7075,7 +7079,7 @@
assertNotNull("Module test_pickletools.py not found", module);
assertEquals("test_pickletools.py", module.getElementName());
-
+
}
public void testModelGen140( ) throws Exception {
@@ -7085,7 +7089,7 @@
assertNotNull("Module test_posix.py not found", module);
assertEquals("test_posix.py", module.getElementName());
-
+
//Class test
{
IType classPosixTester0;
@@ -7254,7 +7258,7 @@
assertNotNull("Module test_marshal.py not found", module);
assertEquals("test_marshal.py", module.getElementName());
-
+
//Class test
{
IType classIntTestCase0;
@@ -7428,7 +7432,7 @@
assertNotNull("Module test_scope.py not found", module);
assertEquals("test_scope.py", module.getElementName());
-
+
//Function test:make_adder
{
IMethod methodmake_adder0;
@@ -8128,7 +8132,7 @@
assertNotNull("Module test_urlparse.py not found", module);
assertEquals("test_urlparse.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "RFC1808_BASE");
@@ -8214,7 +8218,7 @@
assertNotNull("Module test_complex.py not found", module);
assertEquals("test_complex.py", module.getElementName());
-
+
//Class test
{
IType classComplexTest0;
@@ -8468,7 +8472,7 @@
assertNotNull("Module test_symtable.py not found", module);
assertEquals("test_symtable.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "symbols");
@@ -8489,7 +8493,7 @@
assertNotNull("Module test_descrtut.py not found", module);
assertEquals("test_descrtut.py", module.getElementName());
-
+
//Class test
{
IType classdefaultdict0;
@@ -8666,7 +8670,7 @@
assertNotNull("Module xmltests.py not found", module);
assertEquals("xmltests.py", module.getElementName());
-
+
//Function test:runtest
{
IMethod methodruntest0;
@@ -8683,7 +8687,7 @@
assertNotNull("Module test_filecmp.py not found", module);
assertEquals("test_filecmp.py", module.getElementName());
-
+
//Class test
{
IType classFileCompareTestCase0;
@@ -8767,9 +8771,8 @@
assertNotNull("Module test_bastion.py not found", module);
assertEquals("test_bastion.py", module.getElementName());
-
+
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests3.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests3.java
index aa1a317..c0dc0af 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests3.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests3.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests3 extends AbstractModelTests
{
public GeneratedModelTests3(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests3.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_3", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_3" );
@@ -44,7 +48,7 @@
assertNotNull("Module test_cgi.py not found", module);
assertEquals("test_cgi.py", module.getElementName());
-
+
//Class test
{
IType classHackedSysModule0;
@@ -144,7 +148,7 @@
assertNotNull("Module test_bz2.py not found", module);
assertEquals("test_bz2.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "has_cmdline_bunzip2");
@@ -458,7 +462,7 @@
assertNotNull("Module test_getopt.py not found", module);
assertEquals("test_getopt.py", module.getElementName());
-
+
//Function test:expectException
{
IMethod methodexpectException0;
@@ -495,7 +499,7 @@
assertNotNull("Module test_dbm.py not found", module);
assertEquals("test_dbm.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "filename");
@@ -527,7 +531,7 @@
assertNotNull("Module test_mimetools.py not found", module);
assertEquals("test_mimetools.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "msgtext1");
@@ -574,7 +578,7 @@
assertNotNull("Module test_largefile.py not found", module);
assertEquals("test_largefile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "oldhandler");
@@ -627,7 +631,7 @@
assertNotNull("Module test_urllibnet.py not found", module);
assertEquals("test_urllibnet.py", module.getElementName());
-
+
//Class test
{
IType classURLTimeoutTest0;
@@ -749,7 +753,7 @@
assertNotNull("Module test_operations.py not found", module);
assertEquals("test_operations.py", module.getElementName());
-
+
//Class test
{
IType classBadDictKey0;
@@ -799,7 +803,7 @@
assertNotNull("Module test_csv.py not found", module);
assertEquals("test_csv.py", module.getElementName());
-
+
//Class test
{
IType classTest_Csv0;
@@ -1636,7 +1640,7 @@
assertNotNull("Module test_dis.py not found", module);
assertEquals("test_dis.py", module.getElementName());
-
+
//Function test:_f
{
IMethod method_f0;
@@ -1721,7 +1725,7 @@
assertNotNull("Module test_itertools.py not found", module);
assertEquals("test_itertools.py", module.getElementName());
-
+
//Function test:onearg
{
IMethod methodonearg0;
@@ -2394,7 +2398,7 @@
assertNotNull("Module test_multifile.py not found", module);
assertEquals("test_multifile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "msg");
@@ -2421,7 +2425,7 @@
assertNotNull("Module test_eof.py not found", module);
assertEquals("test_eof.py", module.getElementName());
-
+
//Class test
{
IType classEOFTestCase0;
@@ -2457,7 +2461,7 @@
assertNotNull("Module test_cookielib.py not found", module);
assertEquals("test_cookielib.py", module.getElementName());
-
+
//Class test
{
IType classDateTimeTests0;
@@ -2916,7 +2920,7 @@
assertNotNull("Module test_unicodedata.py not found", module);
assertEquals("test_unicodedata.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "encoding");
@@ -3080,7 +3084,7 @@
assertNotNull("Module test_glob.py not found", module);
assertEquals("test_glob.py", module.getElementName());
-
+
//Function test:mkdirs
{
IMethod methodmkdirs0;
@@ -3200,7 +3204,7 @@
assertNotNull("Module test_fnmatch.py not found", module);
assertEquals("test_fnmatch.py", module.getElementName());
-
+
//Class test
{
IType classFnmatchTestCase0;
@@ -3236,7 +3240,7 @@
assertNotNull("Module test_hash.py not found", module);
assertEquals("test_hash.py", module.getElementName());
-
+
//Class test
{
IType classHashEqualityTestCase0;
@@ -3286,7 +3290,7 @@
assertNotNull("Module test_stringprep.py not found", module);
assertEquals("test_stringprep.py", module.getElementName());
-
+
}
public void testModelGen169( ) throws Exception {
@@ -3296,7 +3300,7 @@
assertNotNull("Module test_strftime.py not found", module);
assertEquals("test_strftime.py", module.getElementName());
-
+
//Function test:main
{
IMethod methodmain0;
@@ -3333,7 +3337,7 @@
assertNotNull("Module test_grp.py not found", module);
assertEquals("test_grp.py", module.getElementName());
-
+
//Class test
{
IType classGroupDatabaseTestCase0;
@@ -3376,7 +3380,7 @@
assertNotNull("Module test_gettext.py not found", module);
assertEquals("test_gettext.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "GNU_MO_DATA");
@@ -3715,7 +3719,7 @@
assertNotNull("Module test_pickle.py not found", module);
assertEquals("test_pickle.py", module.getElementName());
-
+
//Class test
{
IType classPickleTests0;
@@ -3829,7 +3833,7 @@
assertNotNull("Module test_format.py not found", module);
assertEquals("test_format.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "overflowok");
@@ -3880,7 +3884,7 @@
assertNotNull("Module re_tests.py not found", module);
assertEquals("re_tests.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "benchmarks");
@@ -3902,7 +3906,7 @@
assertNotNull("Module test_tempfile.py not found", module);
assertEquals("test_tempfile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "has_stat");
@@ -4411,7 +4415,7 @@
assertNotNull("Module test_urllib2.py not found", module);
assertEquals("test_urllib2.py", module.getElementName());
-
+
//Class test
{
IType classTrivialTests0;
@@ -4997,7 +5001,7 @@
assertNotNull("Module test_imp.py not found", module);
assertEquals("test_imp.py", module.getElementName());
-
+
//Function test:verify_lock_state
{
IMethod methodverify_lock_state0;
@@ -5026,7 +5030,7 @@
assertNotNull("Module test_fcntl.py not found", module);
assertEquals("test_fcntl.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "filename");
@@ -5092,7 +5096,7 @@
assertNotNull("Module test_mutants.py not found", module);
assertEquals("test_mutants.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "dict1");
@@ -5314,7 +5318,7 @@
assertNotNull("Module doctest_aliases.py not found", module);
assertEquals("doctest_aliases.py", module.getElementName());
-
+
//Class test
{
IType classTwoNames0;
@@ -5337,7 +5341,7 @@
assertNotNull("Module test_threading_local.py not found", module);
assertEquals("test_threading_local.py", module.getElementName());
-
+
//Function test:test_main
{
IMethod methodtest_main0;
@@ -5367,7 +5371,7 @@
assertNotNull("Module test_winsound.py not found", module);
assertEquals("test_winsound.py", module.getElementName());
-
+
//Class test
{
IType classBeepTest0;
@@ -5534,7 +5538,7 @@
assertNotNull("Module test_richcmp.py not found", module);
assertEquals("test_richcmp.py", module.getElementName());
-
+
//Class test
{
IType classNumber0;
@@ -5975,7 +5979,7 @@
assertNotNull("Module test_md5.py not found", module);
assertEquals("test_md5.py", module.getElementName());
-
+
//Function test:hexstr
{
IMethod methodhexstr0;
@@ -6032,7 +6036,7 @@
assertNotNull("Module test_bsddb3.py not found", module);
assertEquals("test_bsddb3.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "verbose");
@@ -6066,7 +6070,7 @@
assertNotNull("Module test_module.py not found", module);
assertEquals("test_module.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "module");
@@ -6104,7 +6108,7 @@
assertNotNull("Module test_syntax.py not found", module);
assertEquals("test_syntax.py", module.getElementName());
-
+
//Class test
{
IType classSyntaxTestCase0;
@@ -6154,7 +6158,7 @@
assertNotNull("Module test_strptime.py not found", module);
assertEquals("test_strptime.py", module.getElementName());
-
+
//Class test
{
IType classgetlang_Tests0;
@@ -6554,7 +6558,7 @@
assertNotNull("Module test_curses.py not found", module);
assertEquals("test_curses.py", module.getElementName());
-
+
//Function test:window_funcs
{
IMethod methodwindow_funcs0;
@@ -6595,7 +6599,7 @@
assertNotNull("Module test_hexoct.py not found", module);
assertEquals("test_hexoct.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "platform_long_is_32_bits");
@@ -6649,7 +6653,7 @@
assertNotNull("Module test_new.py not found", module);
assertEquals("test_new.py", module.getElementName());
-
+
//Class test
{
IType classEggs0;
@@ -6860,7 +6864,7 @@
assertNotNull("Module test_structseq.py not found", module);
assertEquals("test_structseq.py", module.getElementName());
-
+
//Class test
{
IType classStructSeqTest0;
@@ -6985,7 +6989,7 @@
assertNotNull("Module test_nis.py not found", module);
assertEquals("test_nis.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "maps");
@@ -7011,7 +7015,7 @@
assertNotNull("Module test_locale.py not found", module);
assertEquals("test_locale.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "oldlocale");
@@ -7055,7 +7059,7 @@
assertNotNull("Module test_imaplib.py not found", module);
assertEquals("test_imaplib.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "timevalues");
@@ -7069,7 +7073,7 @@
assertNotNull("Module test_grammar.py not found", module);
assertEquals("test_grammar.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "x");
@@ -7926,7 +7930,7 @@
assertNotNull("Module test_difflib.py not found", module);
assertEquals("test_difflib.py", module.getElementName());
-
+
//Class test
{
IType classTestSFbugs0;
@@ -7997,7 +8001,7 @@
assertNotNull("Module test_unittest.py not found", module);
assertEquals("test_unittest.py", module.getElementName());
-
+
//Function test:test_TestSuite_iter
{
IMethod methodtest_TestSuite_iter0;
@@ -8019,7 +8023,7 @@
assertNotNull("Module test_future.py not found", module);
assertEquals("test_future.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "rx");
@@ -8117,4 +8121,3 @@
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests4.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests4.java
index c24e5ed..66c9daf 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests4.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests4.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests4 extends AbstractModelTests
{
public GeneratedModelTests4(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests4.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_4", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_4" );
@@ -44,7 +48,7 @@
assertNotNull("Module test_slice.py not found", module);
assertEquals("test_slice.py", module.getElementName());
-
+
//Class test
{
IType classSliceTest0;
@@ -133,7 +137,7 @@
assertNotNull("Module test_pkg.py not found", module);
assertEquals("test_pkg.py", module.getElementName());
-
+
//Function test:mkhier
{
IMethod methodmkhier0;
@@ -205,7 +209,7 @@
assertNotNull("Module test_fileinput.py not found", module);
assertEquals("test_fileinput.py", module.getElementName());
-
+
//Function test:writeTmp
{
IMethod methodwriteTmp0;
@@ -290,7 +294,7 @@
assertNotNull("Module test_pow.py not found", module);
assertEquals("test_pow.py", module.getElementName());
-
+
//Class test
{
IType classPowTest0;
@@ -374,7 +378,7 @@
assertNotNull("Module test_univnewlines.py not found", module);
assertEquals("test_univnewlines.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "FATX");
@@ -559,7 +563,7 @@
assertNotNull("Module test_MimeWriter.py not found", module);
assertEquals("test_MimeWriter.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "SELLER");
@@ -599,7 +603,7 @@
assertNotNull("Module test_pty.py not found", module);
assertEquals("test_pty.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TEST_STRING_1");
@@ -652,7 +656,7 @@
assertNotNull("Module test_pwd.py not found", module);
assertEquals("test_pwd.py", module.getElementName());
-
+
//Class test
{
IType classPwdTest0;
@@ -688,7 +692,7 @@
assertNotNull("Module test_tuple.py not found", module);
assertEquals("test_tuple.py", module.getElementName());
-
+
//Class test
{
IType classTupleTest0;
@@ -776,7 +780,7 @@
assertNotNull("Module test_hmac.py not found", module);
assertEquals("test_hmac.py", module.getElementName());
-
+
//Class test
{
IType classTestVectorsTestCase0;
@@ -900,7 +904,7 @@
assertNotNull("Module test_dummy_threading.py not found", module);
assertEquals("test_dummy_threading.py", module.getElementName());
-
+
//Class test
{
IType classTestThread0;
@@ -935,7 +939,7 @@
assertNotNull("Module test_decorators.py not found", module);
assertEquals("test_decorators.py", module.getElementName());
-
+
//Function test:funcattrs
{
IMethod methodfuncattrs0;
@@ -1287,7 +1291,7 @@
assertNotNull("Module pydocfodder.py not found", module);
assertEquals("pydocfodder.py", module.getElementName());
-
+
//Class test
{
IType classA_classic0;
@@ -1920,7 +1924,7 @@
assertNotNull("Module test_sax.py not found", module);
assertEquals("test_sax.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "tests");
@@ -2341,7 +2345,7 @@
assertNotNull("Module test_bufio.py not found", module);
assertEquals("test_bufio.py", module.getElementName());
-
+
//Function test:drive_one
{
IMethod methoddrive_one0;
@@ -2373,7 +2377,7 @@
assertNotNull("Module test_set.py not found", module);
assertEquals("test_set.py", module.getElementName());
-
+
//Class test
{
IType classPassThru0;
@@ -4099,7 +4103,7 @@
assertNotNull("Module test_sha.py not found", module);
assertEquals("test_sha.py", module.getElementName());
-
+
//Class test
{
IType classSHATestCase0;
@@ -4149,7 +4153,7 @@
assertNotNull("Module badsyntax_future3.py not found", module);
assertEquals("badsyntax_future3.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4177,7 +4181,7 @@
assertNotNull("Module badsyntax_future4.py not found", module);
assertEquals("badsyntax_future4.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4205,7 +4209,7 @@
assertNotNull("Module badsyntax_future5.py not found", module);
assertEquals("badsyntax_future5.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4233,7 +4237,7 @@
assertNotNull("Module badsyntax_future6.py not found", module);
assertEquals("badsyntax_future6.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4261,7 +4265,7 @@
assertNotNull("Module badsyntax_future7.py not found", module);
assertEquals("badsyntax_future7.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4289,7 +4293,7 @@
assertNotNull("Module badsyntax_future8.py not found", module);
assertEquals("badsyntax_future8.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4313,7 +4317,7 @@
assertNotNull("Module badsyntax_future9.py not found", module);
assertEquals("badsyntax_future9.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -4337,7 +4341,7 @@
assertNotNull("Module test_tcl.py not found", module);
assertEquals("test_tcl.py", module.getElementName());
-
+
//Class test
{
IType classTclTest0;
@@ -4506,7 +4510,7 @@
assertNotNull("Module test_codecs.py not found", module);
assertEquals("test_codecs.py", module.getElementName());
-
+
//Class test
{
IType classQueue0;
@@ -4828,7 +4832,7 @@
assertNotNull("Module test_str.py not found", module);
assertEquals("test_str.py", module.getElementName());
-
+
//Class test
{
IType classStrTest0;
@@ -4868,7 +4872,7 @@
assertNotNull("Module test_deque.py not found", module);
assertEquals("test_deque.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "BIG");
@@ -5373,7 +5377,7 @@
assertNotNull("Module test_gzip.py not found", module);
assertEquals("test_gzip.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "filename");
@@ -5487,7 +5491,7 @@
assertNotNull("Module test_ucn.py not found", module);
assertEquals("test_ucn.py", module.getElementName());
-
+
//Class test
{
IType classUnicodeNamesTest0;
@@ -5572,7 +5576,7 @@
assertNotNull("Module test_sys.py not found", module);
assertEquals("test_sys.py", module.getElementName());
-
+
//Class test
{
IType classSysModuleTest0;
@@ -5712,7 +5716,7 @@
assertNotNull("Module test_descr.py not found", module);
assertEquals("test_descr.py", module.getElementName());
-
+
//Function test:veris
{
IMethod methodveris0;
@@ -9921,7 +9925,7 @@
assertNotNull("Module test_robotparser.py not found", module);
assertEquals("test_robotparser.py", module.getElementName());
-
+
//Class test
{
IType classRobotTestCase0;
@@ -10047,7 +10051,7 @@
assertNotNull("Module test_netrc.py not found", module);
assertEquals("test_netrc.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TEST_NETRC");
@@ -10098,7 +10102,7 @@
assertNotNull("Module test_codeop.py not found", module);
assertEquals("test_codeop.py", module.getElementName());
-
+
//Function test:unify_callables
{
IMethod methodunify_callables0;
@@ -10176,7 +10180,7 @@
assertNotNull("Module test_imgfile.py not found", module);
assertEquals("test_imgfile.py", module.getElementName());
-
+
//Function test:main
{
IMethod methodmain0;
@@ -10199,7 +10203,7 @@
assertNotNull("Module test_wave.py not found", module);
assertEquals("test_wave.py", module.getElementName());
-
+
//Function test:check
{
IMethod methodcheck0;
@@ -10248,7 +10252,7 @@
assertNotNull("Module test_macostools.py not found", module);
assertEquals("test_macostools.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TESTFN2");
@@ -10323,7 +10327,7 @@
assertNotNull("Module test_exceptions.py not found", module);
assertEquals("test_exceptions.py", module.getElementName());
-
+
//Function test:test_raise_catch
{
IMethod methodtest_raise_catch0;
@@ -10443,7 +10447,7 @@
assertNotNull("Module test_global.py not found", module);
assertEquals("test_global.py", module.getElementName());
-
+
//Function test:compile_and_check
{
IMethod methodcompile_and_check0;
@@ -10476,7 +10480,7 @@
assertNotNull("Module test_bisect.py not found", module);
assertEquals("test_bisect.py", module.getElementName());
-
+
//Class test
{
IType classTestBisect0;
@@ -10639,7 +10643,7 @@
assertNotNull("Module test_binascii.py not found", module);
assertEquals("test_binascii.py", module.getElementName());
-
+
//Class test
{
IType classBinASCIITest0;
@@ -10735,7 +10739,7 @@
assertNotNull("Module test_queue.py not found", module);
assertEquals("test_queue.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "QUEUE_SIZE");
@@ -10836,7 +10840,7 @@
assertNotNull("Module test_logging.py not found", module);
assertEquals("test_logging.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "BANNER");
@@ -11106,7 +11110,7 @@
assertNotNull("Module test_ntpath.py not found", module);
assertEquals("test_ntpath.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "errors");
@@ -11127,7 +11131,7 @@
assertNotNull("Module pystone.py not found", module);
assertEquals("pystone.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "LOOPS");
@@ -11320,7 +11324,7 @@
assertNotNull("Module test_future1.py not found", module);
assertEquals("test_future1.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -11348,7 +11352,7 @@
assertNotNull("Module test_future2.py not found", module);
assertEquals("test_future2.py", module.getElementName());
-
+
//Function test:f
{
IMethod methodf0;
@@ -11376,7 +11380,7 @@
assertNotNull("Module test_future3.py not found", module);
assertEquals("test_future3.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "x");
@@ -11435,7 +11439,7 @@
assertNotNull("Module test_userstring.py not found", module);
assertEquals("test_userstring.py", module.getElementName());
-
+
//Class test
{
IType classUserStringTest0;
@@ -11477,4 +11481,3 @@
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests5.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests5.java
index 46bb10f..1a5c7d2 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests5.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests5.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests5 extends AbstractModelTests
{
public GeneratedModelTests5(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests5.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_5", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_5" );
@@ -44,7 +48,7 @@
assertNotNull("Module string_tests.py not found", module);
assertEquals("string_tests.py", module.getElementName());
-
+
//Class test
{
IType classSequence0;
@@ -475,7 +479,7 @@
assertNotNull("Module test_charmapcodec.py not found", module);
assertEquals("test_charmapcodec.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "codecname");
@@ -529,7 +533,7 @@
assertNotNull("Module test_timeout.py not found", module);
assertEquals("test_timeout.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "skip_expected");
@@ -691,7 +695,7 @@
assertNotNull("Module test_xmllib.py not found", module);
assertEquals("test_xmllib.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "testdoc");
@@ -748,7 +752,7 @@
assertNotNull("Module test_call.py not found", module);
assertEquals("test_call.py", module.getElementName());
-
+
//Class test
{
IType classCFunctionCalls0;
@@ -959,7 +963,7 @@
assertNotNull("Module test_array.py not found", module);
assertEquals("test_array.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "tests");
@@ -1697,7 +1701,7 @@
assertNotNull("Module test_capi.py not found", module);
assertEquals("test_capi.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "test");
@@ -1735,7 +1739,7 @@
assertNotNull("Module test_cpickle.py not found", module);
assertEquals("test_cpickle.py", module.getElementName());
-
+
//Class test
{
IType classcPickleTests0;
@@ -1879,7 +1883,7 @@
assertNotNull("Module test_import.py not found", module);
assertEquals("test_import.py", module.getElementName());
-
+
//Function test:remove_files
{
IMethod methodremove_files0;
@@ -1930,7 +1934,7 @@
assertNotNull("Module test__locale.py not found", module);
assertEquals("test__locale.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "candidate_locales");
@@ -1977,7 +1981,7 @@
assertNotNull("Module test_threadedtempfile.py not found", module);
assertEquals("test_threadedtempfile.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "NUM_THREADS");
@@ -2034,7 +2038,7 @@
assertNotNull("Module test_socket.py not found", module);
assertEquals("test_socket.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "PORT");
@@ -2920,7 +2924,7 @@
assertNotNull("Module test_builtin.py not found", module);
assertEquals("test_builtin.py", module.getElementName());
-
+
//Class test
{
IType classSquares0;
@@ -3966,7 +3970,7 @@
assertNotNull("Module test_bool.py not found", module);
assertEquals("test_bool.py", module.getElementName());
-
+
//Class test
{
IType classBoolTest0;
@@ -4201,7 +4205,7 @@
assertNotNull("Module test_getargs2.py not found", module);
assertEquals("test_getargs2.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "LARGE");
@@ -4344,7 +4348,7 @@
assertNotNull("Module test_signal.py not found", module);
assertEquals("test_signal.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "x");
@@ -4406,7 +4410,7 @@
assertNotNull("Module test_opcodes.py not found", module);
assertEquals("test_opcodes.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "n");
@@ -4531,7 +4535,7 @@
assertNotNull("Module test_coercion.py not found", module);
assertEquals("test_coercion.py", module.getElementName());
-
+
//Class test
{
IType classCoerceNumber0;
@@ -4717,7 +4721,7 @@
assertNotNull("Module test_unicode_file.py not found", module);
assertEquals("test_unicode_file.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TESTFN_ENCODED");
@@ -4821,7 +4825,7 @@
assertNotNull("Module test_textwrap.py not found", module);
assertEquals("test_textwrap.py", module.getElementName());
-
+
//Class test
{
IType classBaseTestCase0;
@@ -5084,7 +5088,7 @@
assertNotNull("Module test_macpath.py not found", module);
assertEquals("test_macpath.py", module.getElementName());
-
+
//Class test
{
IType classMacPathTestCase0;
@@ -5148,7 +5152,7 @@
assertNotNull("Module test_funcattrs.py not found", module);
assertEquals("test_funcattrs.py", module.getElementName());
-
+
//Class test
{
IType classF0;
@@ -5472,7 +5476,7 @@
assertNotNull("Module test_mailbox.py not found", module);
assertEquals("test_mailbox.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "FROM_");
@@ -5558,7 +5562,7 @@
assertNotNull("Module test_heapq.py not found", module);
assertEquals("test_heapq.py", module.getElementName());
-
+
//Function test:heapiter
{
IMethod methodheapiter0;
@@ -5906,7 +5910,7 @@
assertNotNull("Module test_contains.py not found", module);
assertEquals("test_contains.py", module.getElementName());
-
+
//Class test
{
IType classbase_set0;
@@ -6012,7 +6016,7 @@
assertNotNull("Module test_poll.py not found", module);
assertEquals("test_poll.py", module.getElementName());
-
+
//Function test:find_ready_matching
{
IMethod methodfind_ready_matching0;
@@ -6066,7 +6070,7 @@
assertNotNull("Module test_xmlrpc.py not found", module);
assertEquals("test_xmlrpc.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "have_unicode");
@@ -6142,7 +6146,7 @@
assertNotNull("Module test_longexp.py not found", module);
assertEquals("test_longexp.py", module.getElementName());
-
+
//Class test
{
IType classLongExpText0;
@@ -6171,7 +6175,7 @@
assertNotNull("Module test_codecencodings_cn.py not found", module);
assertEquals("test_codecencodings_cn.py", module.getElementName());
-
+
//Class test
{
IType classTest_GB23120;
@@ -6245,7 +6249,7 @@
assertNotNull("Module test_operator.py not found", module);
assertEquals("test_operator.py", module.getElementName());
-
+
//Class test
{
IType classOperatorTestCase0;
@@ -6652,7 +6656,7 @@
assertNotNull("Module test_base64.py not found", module);
assertEquals("test_base64.py", module.getElementName());
-
+
//Class test
{
IType classLegacyBase64TestCase0;
@@ -6777,7 +6781,7 @@
assertNotNull("Module test_codecencodings_hk.py not found", module);
assertEquals("test_codecencodings_hk.py", module.getElementName());
-
+
//Class test
{
IType classTest_Big5HKSCS0;
@@ -6811,7 +6815,7 @@
assertNotNull("Module test_codecencodings_jp.py not found", module);
assertEquals("test_codecencodings_jp.py", module.getElementName());
-
+
//Class test
{
IType classTest_CP9320;
@@ -6933,7 +6937,7 @@
assertNotNull("Module test_subprocess.py not found", module);
assertEquals("test_subprocess.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "mswindows");
@@ -7289,7 +7293,7 @@
assertNotNull("Module test_codecencodings_kr.py not found", module);
assertEquals("test_codecencodings_kr.py", module.getElementName());
-
+
//Class test
{
IType classTest_CP9490;
@@ -7359,7 +7363,7 @@
assertNotNull("Module test_httplib.py not found", module);
assertEquals("test_httplib.py", module.getElementName());
-
+
//Class test
{
IType classFakeSocket0;
@@ -7468,7 +7472,7 @@
assertNotNull("Module test_posixpath.py not found", module);
assertEquals("test_posixpath.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "ABSTFN");
@@ -7718,7 +7722,7 @@
assertNotNull("Module test_distutils.py not found", module);
assertEquals("test_distutils.py", module.getElementName());
-
+
//Function test:test_main
{
IMethod methodtest_main0;
@@ -7734,7 +7738,7 @@
assertNotNull("Module test_copy_reg.py not found", module);
assertEquals("test_copy_reg.py", module.getElementName());
-
+
//Class test
{
IType classC0;
@@ -7797,7 +7801,7 @@
assertNotNull("Module __init__.py not found", module);
assertEquals("__init__.py", module.getElementName());
-
+
}
public void REM_testModelGen290( ) throws Exception {
@@ -7807,7 +7811,7 @@
assertNotNull("Module test_class.py not found", module);
assertEquals("test_class.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "testmeths");
@@ -8086,7 +8090,7 @@
assertNotNull("Module test_warnings.py not found", module);
assertEquals("test_warnings.py", module.getElementName());
-
+
//Class test
{
IType classWarningMessage0;
@@ -8157,7 +8161,7 @@
assertNotNull("Module test_codecencodings_tw.py not found", module);
assertEquals("test_codecencodings_tw.py", module.getElementName());
-
+
//Class test
{
IType classTest_Big50;
@@ -8191,7 +8195,7 @@
assertNotNull("Module test_iter.py not found", module);
assertEquals("test_iter.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TRIPLETS");
@@ -8927,7 +8931,7 @@
assertNotNull("Module test_genexps.py not found", module);
assertEquals("test_genexps.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "doctests");
@@ -8952,7 +8956,7 @@
assertNotNull("Module test___future__.py not found", module);
assertEquals("test___future__.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "GOOD_SERIALS");
@@ -8990,7 +8994,7 @@
assertNotNull("Module test_getargs.py not found", module);
assertEquals("test_getargs.py", module.getElementName());
-
+
}
public void testModelGen297( ) throws Exception {
@@ -9000,7 +9004,7 @@
assertNotNull("Module regex_tests.py not found", module);
assertEquals("regex_tests.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "benchmarks");
@@ -9018,7 +9022,7 @@
assertNotNull("Module test_popen2.py not found", module);
assertEquals("test_popen2.py", module.getElementName());
-
+
//Function test:main
{
IMethod methodmain0;
@@ -9040,7 +9044,7 @@
assertNotNull("Module test_plistlib.py not found", module);
assertEquals("test_plistlib.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "TESTDATA");
@@ -9138,4 +9142,3 @@
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests6.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests6.java
index c454e38..2920aeb 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests6.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/GeneratedModelTests6.java
@@ -1,30 +1,33 @@
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
+import java.net.URL;
+
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
import org.eclipse.dltk.core.tests.util.ModelTestUtils;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
-import java.net.URL;
import org.osgi.framework.Bundle;
+import junit.framework.Test;
+
public class GeneratedModelTests6 extends AbstractModelTests
{
public GeneratedModelTests6(String name) {
super( PythonTestsPlugin.PLUGIN_NAME, name);
}
-
+
public static Test suite() {
return new Suite( GeneratedModelTests6.class);
}
-
+
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
IScriptProject scriptProject = setUpScriptProjectTo( "pytests_6", "pytests" );
@@ -33,6 +36,7 @@
ModelTestUtils.exractZipInto(scriptProject, entry);
// Extract all files from selected zip file.
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
deleteProject( "pytests_6" );
@@ -44,7 +48,7 @@
assertNotNull("Module test_mimetypes.py not found", module);
assertEquals("test_mimetypes.py", module.getElementName());
-
+
//Class test
{
IType classMimeTypesTestCase0;
@@ -108,7 +112,7 @@
assertNotNull("Module test_inspect.py not found", module);
assertEquals("test_inspect.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "source");
@@ -509,7 +513,7 @@
assertNotNull("Module test_support.py not found", module);
assertEquals("test_support.py", module.getElementName());
-
+
//Class test
{
IType classError0;
@@ -740,7 +744,7 @@
assertNotNull("Module list_tests.py not found", module);
assertEquals("list_tests.py", module.getElementName());
-
+
//Class test
{
IType classCommonTest0;
@@ -1008,7 +1012,7 @@
assertNotNull("Module test_strop.py not found", module);
assertEquals("test_strop.py", module.getElementName());
-
+
//Class test
{
IType classStropFunctionTestCase0;
@@ -1187,7 +1191,7 @@
assertNotNull("Module test_ioctl.py not found", module);
assertEquals("test_ioctl.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "tty");
@@ -1227,7 +1231,7 @@
assertNotNull("Module test_traceback.py not found", module);
assertEquals("test_traceback.py", module.getElementName());
-
+
//Class test
{
IType classTracebackCases0;
@@ -1291,7 +1295,7 @@
assertNotNull("Module test_pyexpat.py not found", module);
assertEquals("test_pyexpat.py", module.getElementName());
-
+
//Class test
{
IType classOutputter0;
@@ -1581,7 +1585,7 @@
assertNotNull("Module test_shelve.py not found", module);
assertEquals("test_shelve.py", module.getElementName());
-
+
//Class test
{
IType classTestCase0;
@@ -1772,7 +1776,7 @@
assertNotNull("Module test_augassign.py not found", module);
assertEquals("test_augassign.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "x");
@@ -2159,7 +2163,7 @@
assertNotNull("Module test_multibytecodec_support.py not found", module);
assertEquals("test_multibytecodec_support.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "__cjkcodecs__");
@@ -2345,7 +2349,7 @@
assertNotNull("Module test_pprint.py not found", module);
assertEquals("test_pprint.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "uni");
@@ -2497,7 +2501,7 @@
assertNotNull("Module test_copy.py not found", module);
assertEquals("test_copy.py", module.getElementName());
-
+
//Class test
{
IType classTestCopy0;
@@ -3829,7 +3833,7 @@
assertNotNull("Module test_weakref.py not found", module);
assertEquals("test_weakref.py", module.getElementName());
-
+
//Class test
{
IType classC0;
@@ -4669,7 +4673,7 @@
assertNotNull("Module test_minidom.py not found", module);
assertEquals("test_minidom.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "base");
@@ -5414,7 +5418,7 @@
assertNotNull("Module regrtest.py not found", module);
assertEquals("regrtest.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "newsoft");
@@ -5566,7 +5570,7 @@
assertNotNull("Module test_calendar.py not found", module);
assertEquals("test_calendar.py", module.getElementName());
-
+
//Class test
{
IType classCalendarTestCase0;
@@ -5712,7 +5716,7 @@
assertNotNull("Module test_anydbm.py not found", module);
assertEquals("test_anydbm.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "_fname");
@@ -5818,7 +5822,7 @@
assertNotNull("Module test_regex.py not found", module);
assertEquals("test_regex.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "re");
@@ -5895,7 +5899,7 @@
assertNotNull("Module test_decimal.py not found", module);
assertEquals("test_decimal.py", module.getElementName());
-
+
{
IModelElement[] moduleChilds = module.getChildren();
IField fieldValue = ModelTestUtils.getAssertField( moduleChilds, "threading");
@@ -6463,7 +6467,7 @@
assertNotNull("Module test_trace.py not found", module);
assertEquals("test_trace.py", module.getElementName());
-
+
//Function test:basic
{
IMethod methodbasic0;
@@ -7090,7 +7094,7 @@
assertNotNull("Module test_sundry.py not found", module);
assertEquals("test_sundry.py", module.getElementName());
-
+
}
public void testModelGen323( ) throws Exception {
@@ -7100,7 +7104,7 @@
assertNotNull("Module test_htmllib.py not found", module);
assertEquals("test_htmllib.py", module.getElementName());
-
+
//Class test
{
IType classAnchorCollector0;
@@ -7190,7 +7194,7 @@
assertNotNull("Module test_cfgparser.py not found", module);
assertEquals("test_cfgparser.py", module.getElementName());
-
+
//Class test
{
IType classTestCaseBase0;
@@ -7418,4 +7422,3 @@
}
}
-
\ No newline at end of file
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ModelPythonTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ModelPythonTests.java
index f1388cf..722d352 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ModelPythonTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/ModelPythonTests.java
@@ -1,21 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.runtime.Path;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IField;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.tests.model.AbstractModelTests;
@@ -24,6 +21,8 @@
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
import org.eclipse.dltk.utils.CorePrinter;
+import junit.framework.Test;
+
public class ModelPythonTests extends AbstractModelTests {
public ModelPythonTests(String name) {
@@ -34,10 +33,12 @@
return new Suite(ModelPythonTests.class);
}
+ @Override
public void setUpSuite() throws Exception {
super.setUpSuite();
}
+ @Override
public void tearDownSuite() throws Exception {
super.tearDownSuite();
}
@@ -123,15 +124,15 @@
//
// Collection<IModelElement> moduleChildren = module.getChildren();
// assertNotNull( moduleChildren );
- //
+ //
// assertEquals(2, moduleChildren.size());
- //
+ //
// ModelTestUtils.counterAssert(moduleChildren, 1, 0, 1);
- //
+ //
// IType myClass = ModelTestUtils.getAssertClass(moduleChildren, "A" );
// IMethod myMethod = ModelTestUtils.getAssertMethod(moduleChildren, "f", 0
// );
- //
+ //
// assertEquals(module, myClass.getModule());
// assertEquals(module, myMethod.getModule());
// }
@@ -152,7 +153,7 @@
//
// assertEquals(7, moduleChildren.size());
// ModelTestUtils.counterAssert(moduleChildren, 0, 4, 3);
- //
+ //
// IField qwe_Field = ModelTestUtils.getAssertField(moduleChildren, "qwe_"
// );
// IField qweField = ModelTestUtils.getAssertField(moduleChildren, "qwe" );
@@ -160,22 +161,22 @@
// );
// IField qwe3Field = ModelTestUtils.getAssertField(moduleChildren, "qwe3"
// );
- //
+ //
// IMethod iMethod = ModelTestUtils.getAssertMethod(moduleChildren, "i", 4
// );
// ModelTestUtils.assertParameterNames(iMethod, new String[] {"val", "val2",
// "vale", "val4" } );
- //
+ //
// IMethod bMethod = ModelTestUtils.getAssertMethod(moduleChildren, "b", 1
// );
// ModelTestUtils.assertParameterNames( bMethod, new String[] { "t" } );
- //
+ //
// IMethod lambdaMethod = ModelTestUtils.getAssertMethod(moduleChildren, "f"
// , 1);
// ModelTestUtils.assertParameterNames( lambdaMethod, new String[] { "x" }
// );
- //
- //
+ //
+ //
// }
// public void testModel03() throws Exception
// {
@@ -193,7 +194,7 @@
//
// assertEquals(8, moduleChildren.size());
// ModelTestUtils.counterAssert(moduleChildren, 0, 4, 4);
- //
+ //
// IField qwe_Field = ModelTestUtils.getAssertField(moduleChildren, "qwe_"
// );
// IField qweField = ModelTestUtils.getAssertField(moduleChildren, "qwe" );
@@ -201,21 +202,21 @@
// );
// IField qwe3Field = ModelTestUtils.getAssertField(moduleChildren, "qwe3"
// );
- //
+ //
// IMethod iMethod = ModelTestUtils.getAssertMethod(moduleChildren, "i", 4
// );
// ModelTestUtils.assertParameterNames(iMethod, new String[] {"val", "val2",
// "vale", "val4" } );
- //
+ //
// IMethod bMethod = ModelTestUtils.getAssertMethod(moduleChildren, "b", 1
// );
// ModelTestUtils.assertParameterNames( bMethod, new String[] { "t" } );
- //
+ //
// IMethod lambdaMethod = ModelTestUtils.getAssertMethod(moduleChildren, "f"
// , 1);
// ModelTestUtils.assertParameterNames( lambdaMethod, new String[] { "x" }
// );
- //
+ //
// IMethod gMethod = ModelTestUtils.getAssertMethod(moduleChildren, "g", 1
// );
// ModelTestUtils.assertParameterNames( gMethod, new String[] { "la" } );
@@ -236,17 +237,17 @@
//
// assertEquals(1, moduleChildren.size());
// ModelTestUtils.counterAssert(moduleChildren, 0, 0, 1);
- //
+ //
// IMethod fMethod = ModelTestUtils.getAssertMethod(moduleChildren, "f", 1
// );
// ModelTestUtils.assertParameterNames( fMethod, new String[] { "x" } );
- //
+ //
// // Check for sub function g
// Collection<IModelElement> fMethodChilds = fMethod.getChildren();
// assertEquals(1, moduleChildren.size());
// assertNotNull( fMethodChilds );
// ModelTestUtils.counterAssert(moduleChildren, 0, 0, 1);
- //
+ //
// IMethod gMethod = ModelTestUtils.getAssertMethod(fMethodChilds, "g", 1 );
// ModelTestUtils.assertParameterNames( gMethod, new String[] { "y" } );
// }
@@ -263,21 +264,21 @@
//
// Collection<IModelElement> moduleChildren = module.getChildren();
// assertNotNull( moduleChildren );
- //
+ //
// assertEquals(24, moduleChildren.size());
// ModelTestUtils.counterAssert(moduleChildren, 4, 0, 20);
- //
+ //
// // Class SampleClass model testing.
// IType sampleClass = ModelTestUtils.getAssertClass(moduleChildren,
// "SampleClass" );
// {
// Collection< IModelElement > childs = sampleClass.getChildren();
- //
+ //
// assertNotNull( childs );
// assertEquals(10, childs.size());
// ModelTestUtils.counterAssert(childs, 1, 4, 5);
// }
- //
+ //
// }
// public void testModel06() throws Exception
// {
@@ -292,20 +293,20 @@
//
// Collection<IModelElement> moduleChildren = module.getChildren();
// assertNotNull( moduleChildren );
- //
+ //
// assertEquals(24, moduleChildren.size());
// ModelTestUtils.counterAssert(moduleChildren, 4, 0, 20);
- //
+ //
// // Class SampleClass model testing.
// IType sampleClass = ModelTestUtils.getAssertClass(moduleChildren,
// "SampleClass" );
// {
// Collection< IModelElement > childs = sampleClass.getChildren();
- //
+ //
// assertNotNull( childs );
// assertEquals(10, childs.size());
// ModelTestUtils.counterAssert(childs, 1, 4, 5);
// }
- //
+ //
// }
}
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TestProgressMonitor.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TestProgressMonitor.java
index 00bf638..1ce71a7 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TestProgressMonitor.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TestProgressMonitor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
@@ -19,21 +18,25 @@
/**
* @see IProgressMonitor#beginTask
*/
+@Override
public void beginTask(String name, int totalWork) {
}
/**
* @see IProgressMonitor#done
*/
+@Override
public void done() {
}
public static TestProgressMonitor getInstance() {
return singleton;
}
+@Override
public void internalWorked(double work) {
}
/**
* @see IProgressMonitor#isCanceled
*/
+@Override
public boolean isCanceled() {
return --this.isCanceledCounter < 0;
}
@@ -42,27 +45,31 @@
/**
* @see IProgressMonitor#setCanceled
*/
+@Override
public void setCanceled(boolean b) {
}
/*
* Sets the number of time isCanceled() can be called before it returns true.
- */
+ */
public void setCancelledCounter(int counter) {
this.isCanceledCounter = counter;
}
/**
* @see IProgressMonitor#setTaskName
*/
+@Override
public void setTaskName(String name) {
}
/**
* @see IProgressMonitor#subTask
*/
+@Override
public void subTask(String name) {
}
/**
* @see IProgressMonitor#worked
*/
+@Override
public void worked(int work) {
}
}
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TokenPostitionsParserTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TokenPostitionsParserTests.java
index 05910c3..cb7af48 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TokenPostitionsParserTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/TokenPostitionsParserTests.java
@@ -3,8 +3,6 @@
import java.util.Iterator;
import java.util.List;
-import junit.framework.Test;
-
import org.eclipse.dltk.ast.ASTListNode;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
@@ -27,6 +25,8 @@
import org.eclipse.dltk.python.parser.ast.expressions.PythonTestListExpression;
import org.eclipse.dltk.python.parser.ast.expressions.PythonTupleExpression;
+import junit.framework.Test;
+
public class TokenPostitionsParserTests extends SuiteOfTestCases {
private static final String whileScript = "a=1; while a>0 : a=a-1;";
@@ -57,7 +57,7 @@
private static void testWhileStatements(String script) throws Exception {
ModuleDeclaration module = parse(new ModuleSource(script), null);
- List children = ((ASTNode) module.getChilds().iterator().next())
+ List children = module.getChilds().iterator().next()
.getChilds();
Iterator iter = children.iterator();
while (iter.hasNext()) {
@@ -99,7 +99,7 @@
public void testTestListExpr() {
ModuleDeclaration module = parse(new ModuleSource(testExprScript), null);
- List children = ((ASTNode) module.getChilds().iterator().next())
+ List children = module.getChilds().iterator().next()
.getChilds();
PrintExpression printExpr = (PrintExpression) children.get(0);
PythonTestListExpression testListExpr = (PythonTestListExpression) printExpr
diff --git a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/WorkingCopyTests.java b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/WorkingCopyTests.java
index c7f98b1..c473665 100644
--- a/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/WorkingCopyTests.java
+++ b/tests/org.eclipse.dltk.python.tests/src/org/eclipse/dltk/python/tests/model/WorkingCopyTests.java
@@ -1,16 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.tests.model;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -28,6 +25,8 @@
import org.eclipse.dltk.python.core.PythonNature;
import org.eclipse.dltk.python.tests.PythonTestsPlugin;
+import junit.framework.Test;
+
public class WorkingCopyTests extends ModifyingResourceTests {
private static final String[] PYTHON_NATURE = new String[] {
PythonNature.NATURE_ID
@@ -35,6 +34,7 @@
ISourceModule cu = null;
ISourceModule copy = null;
public class TestWorkingCopyOwner extends WorkingCopyOwner {
+ @Override
public IBuffer createBuffer(ISourceModule workingCopy) {
return new TestBuffer(workingCopy);
}
@@ -48,6 +48,7 @@
return new Suite(WorkingCopyTests.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
try {
@@ -55,14 +56,14 @@
"src"
});
this.createFolder("P/src/x/y");
- this.createFile("P/src/x/y/A.py",
- "import os;\n" +
- "class A:\n" +
- " class Inner:\n" +
+ this.createFile("P/src/x/y/A.py",
+ "import os;\n" +
+ "class A:\n" +
+ " class Inner:\n" +
" def __init__():pass\n"+
" innerField = 10;\n" +
- " def innerMethod():pass\n" +
- " FIELD=\"\";\n"+
+ " def innerMethod():pass\n" +
+ " FIELD=\"\";\n"+
" field1=1;\n" +
" field2=false;\n" +
" def foo():pass\n\n");
@@ -74,6 +75,7 @@
}
}
+ @Override
protected void tearDown() throws Exception {
if (this.copy != null)
this.copy.discardWorkingCopy();
diff --git a/tests/org.eclipse.dltk.python.ui.tests/.classpath b/tests/org.eclipse.dltk.python.ui.tests/.classpath
index ce73933..eca7bdb 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/.classpath
+++ b/tests/org.eclipse.dltk.python.ui.tests/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.core.prefs
index 3568415..3a21537 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..43df84b
--- /dev/null
+++ b/tests/org.eclipse.dltk.python.ui.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,59 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/tests/org.eclipse.dltk.python.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.dltk.python.ui.tests/META-INF/MANIFEST.MF
index 3f6d229..c5a18df 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.dltk.python.ui.tests/META-INF/MANIFEST.MF
@@ -15,4 +15,4 @@
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.dltk.python.ui.tests,
org.eclipse.dltk.python.ui.tests.indenting
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/PythonUITestsPlugin.java b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/PythonUITestsPlugin.java
index ca71661..82bfae5 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/PythonUITestsPlugin.java
+++ b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/PythonUITestsPlugin.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.ui.tests;
@@ -31,7 +30,7 @@
public static final String PLUGIN_NAME = "org.eclipse.dltk.python.ui.tests";
//The shared instance.
private static PythonUITestsPlugin plugin;
-
+
/**
* The constructor.
*/
@@ -42,6 +41,7 @@
/**
* This method is called upon plug-in activation
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
@@ -49,6 +49,7 @@
/**
* This method is called when the plug-in is stopped
*/
+ @Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
@@ -60,7 +61,7 @@
public static PythonUITestsPlugin getDefault() {
return plugin;
}
-
+
public IPath getPluginFilePath( String path ) throws IOException {
Bundle bundle = this.getBundle( );
@@ -69,13 +70,13 @@
url = Platform.resolve( url );
return new Path( url.getPath( ) ).makeAbsolute( );
}
-
+
public String getPluginFileContent( String path ) throws IOException {
-
+
IPath filePath = this.getPluginFilePath( path );
if(filePath==null) return null;
-
- InputStream contentStream = new FileInputStream( filePath.toOSString() );
+
+ InputStream contentStream = new FileInputStream( filePath.toOSString() );
BufferedReader bReader = new BufferedReader( new InputStreamReader( contentStream ) );
String content = "";
String line;
diff --git a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyAutoIndentStrategyTest.java b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyAutoIndentStrategyTest.java
index f50097f..64b1568 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyAutoIndentStrategyTest.java
+++ b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyAutoIndentStrategyTest.java
@@ -1,23 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.ui.tests.indenting;
import org.eclipse.dltk.python.internal.ui.text.PythonAutoEditStrategy;
-import org.eclipse.dltk.python.internal.ui.text.PythonPartitionScanner;
import org.eclipse.dltk.python.ui.PythonPreferenceConstants;
import org.eclipse.dltk.python.ui.tests.PythonUITestsPlugin;
import org.eclipse.dltk.python.ui.text.IPythonPartitions;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.rules.FastPartitioner;
public class PyAutoIndentStrategyTest extends PyUITest {
@@ -31,27 +27,9 @@
private DocCmd docCmd;
private String expected;
IPreferenceStore fStore;
-
- /**
- * Installs a partitioner with <code>document</code>.
- *
- * @param document
- * the document
- */
- private void installStuff(Document document) {
- String[] types = new String[] { IPythonPartitions.PYTHON_STRING,
- IPythonPartitions.PYTHON_COMMENT, IDocument.DEFAULT_CONTENT_TYPE };
- FastPartitioner partitioner = new FastPartitioner(
- new PythonPartitionScanner(), types);
- partitioner.connect(document);
- document.setDocumentPartitioner(IPythonPartitions.PYTHON_PARTITIONING,
- partitioner);
- }
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
super.setUp();
fStore = PythonUITestsPlugin.getDefault().getPreferenceStore();
PythonPreferenceConstants.initializeDefaultValues(fStore);
@@ -59,48 +37,46 @@
strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
}
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
super.tearDown();
}
-
+
public void testTab() { System.out.println("Tab\n");
- String str =
- " args = [ '-1', '-2',\n"+
+ String str =
+ " args = [ '-1', '-2',\n"+
" ";
DocCmd docCmd = new DocCmd(str.length(), 0, "\t");
strategy.customizeDocumentCommand(new Document(str), docCmd);
assertEquals("\t", docCmd.text);
}
-
+
public void _testSpaces() { System.out.println("Spaces\n");
DocCmd docCmd = new DocCmd(0, 0, "\t");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals(" ", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, "\t\t");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals(" ", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, "\tabc");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals(" abc", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, "\tabc\t");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals(" abc ", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, " ");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals(" ", docCmd.text);
}
-
-
+
+
public void testNewLineAfterReturn() { System.out.println("NewLineAfterReturn\n"); System.out.println("NewLineAfterReturn\n");
@@ -111,10 +87,10 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-"#ffo".length(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
-
+ assertEquals("\n", docCmd.text);
+
}
-
+
public void testIgnoreComment() { System.out.println("IgnoreComment\n");
String str = "" +
@@ -123,10 +99,10 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
-
+ assertEquals("\n", docCmd.text);
+
}
-
+
public void testIgnoreComment2() { System.out.println("IgnoreComment2\n");
String str = "" +
@@ -136,10 +112,10 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
-
+ assertEquals("\n", docCmd.text);
+
}
-
+
public void _testNewLineAfterOpeningParWithOtherContents() { System.out.println("NewLineAfterOpeningParWithOtherContents\n");
String str = "" +
@@ -148,24 +124,24 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
+ assertEquals("\n ", docCmd.text);
}
-
+
public void _testNewLineAfterReturn2() { System.out.println("NewLineAfterReturn2\n");
String str = "" +
"def m1(self):\n" +
" return ('foo',";
-
-
+
+
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
-
+ assertEquals("\n ", docCmd.text);
+
}
-
-
+
+
public void testMaintainIndent() { System.out.println("MaintainIndent\n");
String str = "" +
@@ -174,15 +150,15 @@
" print 'foo'\n" +
" print 'bla'"+
"";
-
-
+
+
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-"print 'bla'".length(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
-
+ assertEquals("\n ", docCmd.text);
+
}
-
+
public void _testMaintainIndent2() { System.out.println("MaintainIndent2\n");
String str = "" +
@@ -191,18 +167,18 @@
" print 'foo'\n" +
" print 'bla'"+
"";
-
-
+
+
final Document doc = new Document(str);
int offset = doc.getLength()-" print 'bla'".length();
DocCmd docCmd = new DocCmd(offset, 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
- assertEquals(offset+2, docCmd.caretOffset);
-
+ assertEquals("\n ", docCmd.text);
+ assertEquals(offset+2, docCmd.caretOffset);
+
}
-
-
+
+
public void testDontChangeCursorOffset() { System.out.println("DontChangeCursorOffset\n");
String str = "" +
@@ -210,18 +186,18 @@
" if not 1:\n" +
" print 'foo'" +
"";
-
-
+
+
final Document doc = new Document(str);
int offset = doc.getLength()-" 'foo'".length();
DocCmd docCmd = new DocCmd(offset, 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
- assertEquals(-1, docCmd.caretOffset); //don't change it
-
+ assertEquals("\n ", docCmd.text);
+ assertEquals(-1, docCmd.caretOffset); //don't change it
+
}
-
-
+
+
public void testTabIndentToLevel() { System.out.println("TabIndentToLevel\n");
String str = "" +
@@ -232,18 +208,18 @@
" b,\n" +
")" +
"";
-
-
+
+
final Document doc = new Document(str);
int offset = doc.getLength()-"\n b,\n)".length();
DocCmd docCmd = new DocCmd(offset, 0, "\t");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals(" ", docCmd.text);
-
+ assertEquals(" ", docCmd.text);
+
}
-
-
-
+
+
+
public void _testTabIndentToLevel2() { System.out.println("TabIndentToLevel2\n");
String str = "" +
@@ -258,18 +234,18 @@
" \n" +
"" + //we're here (indent to the first level)
"";
-
-
+
+
final Document doc = new Document(str);
int offset = doc.getLength();
DocCmd docCmd = new DocCmd(offset, 0, "\t");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals(" ", docCmd.text);
-
+ assertEquals(" ", docCmd.text);
+
}
-
-
-
+
+
+
public void testTabIndentToLevel3() { System.out.println("TabIndentToLevel3\n");
String str = "" +
@@ -284,18 +260,18 @@
" \n" +
" " + //now that we're already in the first level, indent to the current level
"";
-
-
+
+
final Document doc = new Document(str);
int offset = doc.getLength();
DocCmd docCmd = new DocCmd(offset, 0, "\t");
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals(" ", docCmd.text);
assertEquals(offset - 4, docCmd.offset);
- assertEquals(4, docCmd.length);
+ assertEquals(4, docCmd.length);
}
-
-
+
+
public void testNoAutoIndentClosingPar() { System.out.println("NoAutoIndentClosingPar\n");
String str = "" +
@@ -303,38 +279,38 @@
" what(),\n" + //the next line should be indented to this one, and not to the start of the indent
" )\n" +
"";
-
-
+
+
final Document doc = new Document(str);
- String s =
+ String s =
"\n"+
" )\n";
DocCmd docCmd = new DocCmd(doc.getLength()-s.length(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
-
+ assertEquals("\n ", docCmd.text);
+
}
-
+
public void testNoAutoIndentClosingPar2() { System.out.println("NoAutoIndentClosingPar2\n");
String str = "" +
"newTuple = (\n" +
- " what(),\n" +
+ " what(),\n" +
"\n" + //pressing tab in the start of this line will bring us to the 'what()' level.
" )\n" +
"";
-
-
+
+
final Document doc = new Document(str);
- String s =
+ String s =
"\n"+
" )\n";
DocCmd docCmd = new DocCmd(doc.getLength()-s.length(), 0, "\t");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals(" ", docCmd.text);
-
+ assertEquals(" ", docCmd.text);
+
}
-
+
public void testNewLineAfterLineWithComment() { System.out.println("NewLineAfterLineWithComment\n");
String str = "" +
@@ -343,10 +319,10 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
-
+ assertEquals("\n", docCmd.text);
+
}
-
+
public void testNewLine10() { System.out.println("NewLine10\n");
String str = "" +
@@ -357,10 +333,10 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
-
+ assertEquals("\n ", docCmd.text);
+
}
-
+
public void testNewLine11() { System.out.println("NewLine11\n");
String str = "" +
@@ -371,11 +347,11 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-"if False: 'foo'".length(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
-
+ assertEquals("\n ", docCmd.text);
+
}
-
-
+
+
public void testNewLine12() { System.out.println("NewLine12\n");
String str = "" +
@@ -384,9 +360,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-"print 'done'".length(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n\t", docCmd.text);
+ assertEquals("\n\t", docCmd.text);
}
-
+
public void testNewLine3() { System.out.println("NewLine3\n");
@@ -395,12 +371,12 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-4, 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n\t", docCmd.text);
-
+ assertEquals("\n\t", docCmd.text);
+
String expected = "for a in b: ";
assertEquals(expected, doc.get());
}
-
+
public void testNewLine6() { System.out.println("NewLine6\n");
String str = "" +
@@ -410,9 +386,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
+ assertEquals("\n", docCmd.text);
}
-
+
public void testNewLine6a() { System.out.println("NewLine6a\n");
String str = "" +
@@ -422,9 +398,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
+ assertEquals("\n", docCmd.text);
}
-
+
public void testNewLine7() { System.out.println("NewLine7\n");
String str = "" +
@@ -436,9 +412,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
+ assertEquals("\n", docCmd.text);
}
-
+
public void testNewLine8() { System.out.println("NewLine8\n");
String str = "" +
@@ -450,9 +426,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
+ assertEquals("\n ", docCmd.text);
}
-
+
public void testIndent() { System.out.println("Indent\n");
String str = "" +
@@ -462,9 +438,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-"if foo:".length(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
+ assertEquals("\n ", docCmd.text);
}
-
+
public void testIndentAfterRet() { System.out.println("IndentAfterRet\n");
String str = "" +
@@ -479,9 +455,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n ", docCmd.text);
+ assertEquals("\n ", docCmd.text);
}
-
+
public void testIndentAfterRet2() { System.out.println("IndentAfterRet2\n");
String str = "" +
@@ -496,9 +472,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals(" ", docCmd.text);
+ assertEquals(" ", docCmd.text);
}
-
+
public void testNewLine9() { System.out.println("NewLine9\n");
String str = "" +
@@ -508,9 +484,9 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n \t", docCmd.text);
+ assertEquals("\n \t", docCmd.text);
}
-
+
public void testNewLine4() { System.out.println("NewLine4\n");
String str = "" +
@@ -524,11 +500,11 @@
"def a():\n" +
" print a" +
"";
- assertEquals(expected, doc.get());
- assertEquals("\n", docCmd.text);
-
+ assertEquals(expected, doc.get());
+ assertEquals("\n", docCmd.text);
+
}
-
+
public void _testNewLine5() { System.out.println("NewLine5\n");
String str = "" +
@@ -542,10 +518,10 @@
"def a():\n" +
" " +
"";
- assertEquals(expected, doc.get());
- assertEquals("\n", docCmd.text);
+ assertEquals(expected, doc.get());
+ assertEquals("\n", docCmd.text);
}
-
+
public void testNewLine() { System.out.println("NewLine\n");
String str = "createintervention() #create " +
@@ -553,10 +529,10 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
-
+ assertEquals("\n", docCmd.text);
+
}
-
+
public void testNewLine2() { System.out.println("NewLine2\n");
String str = "err)" +
@@ -564,11 +540,11 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("\n", docCmd.text);
-
+ assertEquals("\n", docCmd.text);
+
}
-
-
+
+
public void testTabInComment() { System.out.println("TabInComment\n");
String str = "#comment" +
@@ -577,9 +553,9 @@
DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals("\t", docCmd.text); // a single tab should go to the correct indent
-
+
}
-
+
public void testIndentingWithTab() { System.out.println("IndentingWithTab\n");
String str = "class C:\n" +
@@ -590,7 +566,7 @@
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals(" \t", docCmd.text); // a single tab should go to the correct indent
}
-
+
public void testIndentingWithTab2() { System.out.println("IndentingWithTab2\n");
String str = "" +
@@ -602,7 +578,7 @@
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals("\t", docCmd.text); // a single tab should go to the correct indent
}
-
+
public void testIndentingWithTab3() { System.out.println("IndentingWithTab3\n");
String str = "" +
@@ -615,7 +591,7 @@
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals(" ", docCmd.text); // a single tab should go to the correct indent
}
-
+
// public void testWithoutSmartIndent() { System.out.println("WithoutSmartIndent\n");
// final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
// prefs.smartIndentAfterPar = false;
@@ -629,7 +605,7 @@
// strategy.customizeDocumentCommand(doc, docCmd);
// assertEquals("\n ", docCmd.text); // a single tab should go to the correct indent
// }
-
+
public void testIndentingWithTab4() { System.out.println("IndentingWithTab4\n");
String str = "" +
@@ -643,7 +619,7 @@
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals("\t", docCmd.text); // a single tab should go to the correct indent
}
-
+
public void testIndentingWithTab5() { System.out.println("IndentingWithTab5\n");
String str = "" +
@@ -657,10 +633,10 @@
strategy.customizeDocumentCommand(doc, docCmd);
//assertEquals(" ", docCmd.text); // a single tab should go to the correct indent
assertEquals (" ", docCmd.text);
- assertEquals (" ".length(), docCmd.length);
+ assertEquals (" ".length(), docCmd.length);
assertEquals (doc.getLength() - " ".length(), docCmd.offset);
}
-
+
public void testIndentingWithTab6() { System.out.println("IndentingWithTab6\n");
String str = "" +
@@ -673,7 +649,7 @@
strategy.customizeDocumentCommand(doc, docCmd);
assertEquals(" \t", docCmd.text); // a single tab should go to the correct indent
}
-
+
public void testIndentingWithTab7() { System.out.println("IndentingWithTab7\n");
String str = "" +
@@ -687,25 +663,25 @@
assertEquals(" \t", docCmd.text); // a single tab should go to the correct indent
assertEquals(2, docCmd.length); // the spaces after the indent should be removed
}
-
+
public void _testTabs() { System.out.println("Tabs\n");
DocCmd docCmd = new DocCmd(0, 0, "\t");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals("\t", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, "\t\t");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals("\t\t", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, "\tabc");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals("\tabc", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, "\tabc\t");
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals("\tabc\t", docCmd.text);
-
+
docCmd = new DocCmd(0, 0, " abc"); //paste
strategy.customizeDocumentCommand(new Document(""), docCmd);
assertEquals("\tabc", docCmd.text);
@@ -721,7 +697,7 @@
"\t";
assertEquals(expected, docCmd.text);
}
-
+
public void _testCommentsIndent2() { System.out.println("CommentsIndent2\n");
//test not indent more
@@ -731,7 +707,7 @@
expected = "\n" +
" ";
assertEquals(expected, docCmd.text);
-
+
//test indent more
doc = " if False:";
docCmd = new DocCmd(doc.length(), 0, "\n");
@@ -740,10 +716,10 @@
" ";
assertEquals(expected, docCmd.text);
}
-
+
public void testIndentLevel3() { System.out.println("IndentLevel3\n");
-
+
String doc = "" +
"a = (1, \n" +
" 2,"; //should keep this indent, and not go to the opening bracket indent.
@@ -752,10 +728,10 @@
String expected = "\n ";
assertEquals(expected, docCmd.text);
}
-
+
public void testIndentLevel() { System.out.println("IndentLevel\n");
-
+
String doc = "" +
"def m1(): #some comment\n" +
" print foo(a,\n" +
@@ -765,10 +741,10 @@
String expected = "\n ";
assertEquals(expected, docCmd.text);
}
-
+
public void testIndentLevel2() { System.out.println("IndentLevel2\n");
-
+
String doc = "" +
"def m1(): #some comment\n" +
" def metfoo(a,\n" +
@@ -778,7 +754,7 @@
String expected = "\n \t";
assertEquals(expected, docCmd.text);
}
-
+
public void testDedent() { System.out.println("Dedent\n");
@@ -788,7 +764,7 @@
strategy.customizeDocumentCommand(new Document(doc), docCmd);
String expected = "\n";
assertEquals(expected, docCmd.text);
-
+
//test ending with
doc = "def m1(): #some comment\n" +
" return";
@@ -796,7 +772,7 @@
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "\n";
assertEquals(expected, docCmd.text);
-
+
//test not dedenting
doc = "def m1(): #some comment\n" +
" returnIs10 = 10";
@@ -805,9 +781,9 @@
expected = "\n"+
" ";
assertEquals(expected, docCmd.text);
-
+
}
-
+
public void testIndentSpaces() { System.out.println("IndentSpaces\n");
//test after class xxx:\n
@@ -817,7 +793,7 @@
String expected = "\n" +
"\t";
assertEquals(expected, docCmd.text);
-
+
//test regular
doc = " a = 2";
docCmd = new DocCmd(doc.length(), 0, "\n");
@@ -835,8 +811,8 @@
" ";
assertEquals(expected, docCmd.text);
*/
- }
-
+ }
+
public void _testAfterClosePar1() { System.out.println("AfterClosePar1\n");
String doc = "m = [a,";
@@ -845,9 +821,9 @@
String expected = "\n" +
" ";
assertEquals(expected, docCmd.text);
-
+
}
-
+
// public void testAfterCloseParOnlyIndent() { System.out.println("AfterCloseParOnlyIndent\n");
// final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
//
@@ -858,9 +834,9 @@
// String expected = "\n" +
// " ";
// assertEquals(expected, docCmd.text);
-//
+//
// }
-
+
// public void testAfterCloseParOnlyIndent2() { System.out.println("AfterCloseParOnlyIndent2\n");
// final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
//
@@ -873,9 +849,9 @@
// String expected = "\n" +
// " ";
// assertEquals(expected, docCmd.text);
-//
+//
// }
-
+
public void testAfterClosePar2() { System.out.println("AfterClosePar2\n");
String doc = "m = [a,\n" +
@@ -885,7 +861,7 @@
String expected = "\n" +
" ";
assertEquals(expected, docCmd.text);
-
+
}
public void _testAfterClosePar() { System.out.println("AfterClosePar\n");
@@ -895,7 +871,7 @@
String expected = "\n" +
" ";
assertEquals(expected, docCmd.text);
-
+
// doc = "m = [a, otherCall(), ]";
// docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last ']'
// strategy.customizeDocumentCommand(new Document(doc), docCmd);
@@ -903,7 +879,7 @@
// " ";
// assertEquals(expected, docCmd.text);
}
-
+
public void _testIndent2() { System.out.println("Indent2\n");
String doc = "m = [a, otherCall(), ";
@@ -919,7 +895,7 @@
// expected = "\n" +
// " ";
// assertEquals(expected, docCmd.text);
-
+
doc = "def m2(self):\n"+
" m1(a, b(), )";
docCmd = new DocCmd(doc.length()-1, 0, "\n"); //right before the last ')'
@@ -927,20 +903,20 @@
expected = "\n" +
" ";
assertEquals(expected, docCmd.text);
-
+
}
-
+
public void _testIndent3() { System.out.println("Indent3\n");
-
+
String doc = ""+
- "properties.create(a = newClass(),";
+ "properties.create(a = newClass(),";
DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
String expected = "\n"+
" ";
assertEquals(expected, docCmd.text);
-
+
}
public void testIndent3a() { System.out.println("Indent3a\n");
@@ -953,7 +929,7 @@
" ";
assertEquals(expected, docCmd.text);
}
-
+
public void _testIndent4() { System.out.println("Indent4\n"); //even if it does not end with ',' we should indent in parenthesis
String doc = ""+
@@ -965,8 +941,8 @@
" ";
assertEquals(expected, docCmd.text);
}
-
- public void testDedent5() { System.out.println("Dedent5\n");
+
+ public void testDedent5() { System.out.println("Dedent5\n");
String doc = ""+
"properties.create(a = newClass(),\n" +
@@ -978,9 +954,9 @@
" ";
assertEquals(expected, docCmd.text);
}
-
+
// public void testNoSmartIndent() { System.out.println("NoSmartIndent\n");
-//
+//
// TestIndentPrefs prefs = new TestIndentPrefs(false, 4, true);
// prefs.smartIndentAfterPar = false;
//
@@ -1032,16 +1008,16 @@
// String doc = null;
// DocCmd docCmd = null;
// String expected = null;
-//
+//
// doc = "class c:\n" +
// " def met";
// docCmd = new DocCmd(doc.length(), 0, "(");
// strategy.customizeDocumentCommand(new Document(doc), docCmd);
// expected = "():";
// assertEquals(expected, docCmd.text);
-//
+//
// }
-
+
/**
* Tests automatically adding/replacing brackets, colons, and parentheses.
* @see PyAutoIndentStrategy
@@ -1053,14 +1029,14 @@
strategy.customizeDocumentCommand(new Document(doc), docCmd);
String expected = "():";
assertEquals(expected, docCmd.text);
-
+
doc = "class c:\n" +
" def met";
docCmd = new DocCmd(doc.length(), 0, "(");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "(self):";
assertEquals(expected, docCmd.text);
-
+
//same as above, but with tabs
doc = "class c:\n" +
"\tdef met";
@@ -1068,31 +1044,31 @@
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "(self):";
assertEquals(expected, docCmd.text);
-
+
doc = "class c(object): #";
docCmd = new DocCmd(doc.length(), 0, "(");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "("; //in comment
assertEquals(expected, docCmd.text);
-
+
doc = "def a";
docCmd = new DocCmd(doc.length(), 0, "(");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "():";
assertEquals(expected, docCmd.text);
-
+
doc = "a";
docCmd = new DocCmd(doc.length(), 0, "(");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "()";
assertEquals(expected, docCmd.text);
-
+
doc = "a()";
docCmd = new DocCmd(doc.length()-1, 0, "(");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "(";
assertEquals(expected, docCmd.text);
-
+
// test very simple ':' detection
doc = "def something():";
docCmd = new DocCmd(doc.length() - 1, 0, ":");
@@ -1109,7 +1085,7 @@
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(32, docCmd.caretOffset);
-
+
// test inputting ':' at the end of a document
doc = "class c:\n" +
" def __init__(self)";
@@ -1118,7 +1094,7 @@
expected = ":";
assertEquals(expected, docCmd.text);
assertEquals(31, docCmd.offset);
-
+
// test same as above, but with a comment
doc = "class c:\n" +
" def __init__(self): # comment";
@@ -1127,7 +1103,7 @@
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(32, docCmd.caretOffset);
-
+
// test inputting ')' at the end of a document
doc = "class c:\n" +
" def __init__(self)";
@@ -1136,7 +1112,7 @@
expected = ")";
assertEquals(expected, docCmd.text);
assertEquals(0, docCmd.caretOffset);
-
+
// test inputting ')' at the end of a document when it should replace a ')'
doc = "class c:\n" +
" def __init__(self)";
@@ -1145,16 +1121,16 @@
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(31, docCmd.caretOffset);
-
+
// test inputting ')' in the middle of the document
- doc = "def __init__(self):\n" +
+ doc = "def __init__(self):\n" +
" pass";
docCmd = new DocCmd(17, 0, ")");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(18, docCmd.caretOffset);
-
+
// check very simple braces insertion
doc = "()";
docCmd = new DocCmd(1, 0, ")");
@@ -1162,7 +1138,7 @@
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(2, docCmd.caretOffset);
-
+
// check simple braces insertion not at end of document
doc = "() ";
docCmd = new DocCmd(1, 0, ")");
@@ -1170,7 +1146,7 @@
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(2, docCmd.caretOffset);
-
+
// check insertion that should happen even being just before a ')'
doc = "(() ";
docCmd = new DocCmd(2, 0, ")");
@@ -1178,7 +1154,7 @@
expected = ")";
assertEquals(expected, docCmd.text);
assertEquals(0, docCmd.caretOffset);
-
+
// check same stuff for brackets
// check simple braces insertion not at end of document
doc = "[] ";
@@ -1187,7 +1163,7 @@
expected = "";
assertEquals(expected, docCmd.text);
assertEquals(2, docCmd.caretOffset);
-
+
// two different kinds of braces next to each other
doc = "([)";
docCmd = new DocCmd(2, 0, "]");
@@ -1196,7 +1172,7 @@
assertEquals(expected, docCmd.text);
assertEquals(0, docCmd.caretOffset);
}
-
+
public void testParens() { System.out.println("Parens\n");
String str = "isShown() #suite()" +
@@ -1204,11 +1180,11 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-") #suite()".length(), 0, ")");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("", docCmd.text);
+ assertEquals("", docCmd.text);
assertEquals(9, docCmd.caretOffset);
-
+
}
-
+
public void testParens2() { System.out.println("Parens2\n");
String str = "isShown() #suite()'" +
@@ -1216,12 +1192,12 @@
final Document doc = new Document(str);
DocCmd docCmd = new DocCmd(doc.getLength()-") #suite()'".length(), 0, ")");
strategy.customizeDocumentCommand(doc, docCmd);
- assertEquals("", docCmd.text);
+ assertEquals("", docCmd.text);
assertEquals(9, docCmd.caretOffset);
-
+
}
-
+
public void testElse() { System.out.println("Else\n");
//first part of test - simple case
@@ -1240,10 +1216,10 @@
" print a\n" +
"else",
doc.get());
-
+
//second part of test - should not dedent
- strDoc =
+ strDoc =
"if foo:\n" +
" if somethingElse:" +
" print a\n" +
@@ -1261,9 +1237,9 @@
" print a\n" +
" else",
doc.get());
-
+
}
-
+
public void _testElif() { System.out.println("Elif\n");
//first part of test - simple case
@@ -1282,10 +1258,10 @@
" print a\n" +
"elif",
doc.get());
-
+
//second part of test - should not dedent
- strDoc =
+ strDoc =
"if foo:\n" +
" if somethingElse:" +
" print a\n" +
@@ -1303,14 +1279,14 @@
" print a\n" +
" elif",
doc.get());
-
+
}
-
-
+
+
public void testElseInFor() { System.out.println("ElseInFor\n");
//first part of test - simple case
- String strDoc =
+ String strDoc =
"for i in []:\n" +
" msg=\"success at %s\" % i\n" +
" else" +
@@ -1329,11 +1305,11 @@
"",
doc.get());
}
-
+
public void testElseInTry() { System.out.println("ElseInTry\n");
//first part of test - simple case
- String strDoc =
+ String strDoc =
"try:\n" +
" print a\n" +
"except:\n" +
@@ -1354,7 +1330,7 @@
"else",
doc.get());
}
-
+
public void _testElifWithPar() { System.out.println("ElifWithPar\n");
//first part of test - simple case
@@ -1373,10 +1349,10 @@
" print a\n" +
"elif",
doc.get());
-
+
//second part of test - should not dedent
- strDoc =
+ strDoc =
"if foo:\n" +
" if somethingElse:" +
" print a\n" +
@@ -1394,7 +1370,7 @@
" print a\n" +
" elif",
doc.get());
-
+
}
public void _testAutoImportStr() { System.out.println("AutoImportStr\n");
@@ -1403,31 +1379,31 @@
strategy.customizeDocumentCommand(new Document(doc), docCmd);
String expected = " import ";
assertEquals(expected, docCmd.text);
-
+
doc = "from xxx import";
docCmd = new DocCmd(doc.length(), 0, " ");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = " ";
assertEquals(expected, docCmd.text);
-
+
doc = "no from xxx";
docCmd = new DocCmd(doc.length(), 0, " ");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = " ";
assertEquals(expected, docCmd.text);
-
+
doc = "From xxx";
docCmd = new DocCmd(doc.length(), 0, " ");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = " ";
assertEquals(expected, docCmd.text);
-
+
doc = "from this space";
docCmd = new DocCmd(doc.length(), 0, " ");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = " ";
assertEquals(expected, docCmd.text);
-
+
doc = "from";
docCmd = new DocCmd(doc.length(), 0, " ");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
@@ -1439,13 +1415,13 @@
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = " ";
assertEquals(expected, docCmd.text);
-
+
doc = "from xxx #import yyy";
docCmd = new DocCmd(8, 0, " ");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = " import ";
assertEquals(expected, docCmd.text);
-
+
}
diff --git a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyUITest.java b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyUITest.java
index b0aa8e4..002f713 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyUITest.java
+++ b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/PyUITest.java
@@ -4,6 +4,7 @@
public class PyUITest extends TestCase {
+ @Override
protected void setUp() throws Exception {
super.setUp();
/* for(int i=0;i<60;i++) {
diff --git a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/SimpleIndentingTest.java b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/SimpleIndentingTest.java
index 8b4d57a..c1a71a5 100644
--- a/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/SimpleIndentingTest.java
+++ b/tests/org.eclipse.dltk.python.ui.tests/src/org/eclipse/dltk/python/ui/tests/indenting/SimpleIndentingTest.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.python.ui.tests.indenting;
@@ -29,10 +28,10 @@
public class SimpleIndentingTest extends PyUITest {
private IPreferenceStore fStore;
-
+
/**
* Installs a partitioner with <code>document</code>.
- *
+ *
* @param document
* the document
*/
@@ -46,9 +45,7 @@
partitioner);
}
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
+ @Override
protected void setUp() throws Exception {
super.setUp();
fStore = PythonUITestsPlugin.getDefault().getPreferenceStore();
@@ -62,16 +59,16 @@
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
-
+
ITypedRegion region = TextUtilities.getPartition(temp, fPartitioning, 2, true);
assertEquals(IPythonPartitions.PYTHON_COMMENT, region.getType());
-
+
region = TextUtilities.getPartition(temp, fPartitioning, temp.getLineOffset(3), true);
assertEquals(IPythonPartitions.PYTHON_STRING, region.getType());
-
+
region = TextUtilities.getPartition(temp, fPartitioning, temp.getLineOffset(5) + 10, true);
assertEquals(IDocument.DEFAULT_CONTENT_TYPE, region.getType());
-
+
region = TextUtilities.getPartition(temp, fPartitioning, temp.getLineOffset(8) + 19, true);
assertEquals(IPythonPartitions.PYTHON_STRING, region.getType());
}
@@ -84,9 +81,9 @@
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
-
- int offset = temp.getLineOffset(0) + temp.getLineLength(0);
-
+
+ int offset = temp.getLineOffset(0) + temp.getLineLength(0);
+
DocumentCommand c = new DocumentCommand() {};
c.doit = true;
c.caretOffset = -1;
@@ -94,27 +91,27 @@
c.length = 0;
c.offset = offset;
c.text="\n";
-
+
strategy.customizeDocumentCommand(temp, c);
-
+
//execute
temp.replace(c.offset, c.length, c.text);
int newOffset = c.offset + (c.text == null ? 0 : c.text.length());
if (c.caretOffset != -1)
newOffset = c.caretOffset;
-
+
temp.stopRewriteSession(session);
-
+
//check document
String correct = "class Foo:\n" +
"\t";
- String result = temp.get();
+ String result = temp.get();
assertEquals(correct, result);
-
+
//check caret position
assertEquals(offset + 1, newOffset);
}
-
+
public void testIndent01_strings() throws Exception {
String text = "print \"hello\"";
Document temp = new Document(text);
@@ -123,9 +120,9 @@
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
-
- int offset = temp.getLineOffset(0) + temp.getLineLength(0);
-
+
+ int offset = temp.getLineOffset(0) + temp.getLineLength(0);
+
DocumentCommand c = new DocumentCommand() {};
c.doit = true;
c.caretOffset = -1;
@@ -133,21 +130,21 @@
c.length = 0;
c.offset = offset;
c.text="\n";
-
+
strategy.customizeDocumentCommand(temp, c);
-
+
//execute
- temp.replace(c.offset, c.length, c.text);
-
+ temp.replace(c.offset, c.length, c.text);
+
temp.stopRewriteSession(session);
-
+
//check document
String correct = "print \"hello\"\n";
- String result = temp.get();
- assertEquals(correct, result);
+ String result = temp.get();
+ assertEquals(correct, result);
}
-
+
public void REM_testIndent05_pasting() throws Exception {
String text0 = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/my_test0_in.py" );
Document temp = new Document("");
@@ -156,9 +153,9 @@
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
-
- int offset = 0;
-
+
+ int offset = 0;
+
DocumentCommand c = new DocumentCommand() {};
c.doit = true;
c.caretOffset = -1;
@@ -166,17 +163,17 @@
c.length = 0;
c.offset = offset;
c.text=text0;
-
+
strategy.customizeDocumentCommand(temp, c);
-
+
//execute
temp.replace(c.offset, c.length, c.text);
-
+
temp.stopRewriteSession(session);
-
- assertEquals (text0, temp.get());
- }
-
+
+ assertEquals (text0, temp.get());
+ }
+
public void REM_testIndent06_pasting() throws Exception {
String textIn = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/my_test1_in.py" );
String text0 = "a = 5\n"+
@@ -197,9 +194,9 @@
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
-
- int offset = temp.getLineOffset(12) + 8;
-
+
+ int offset = temp.getLineOffset(12) + 8;
+
DocumentCommand c = new DocumentCommand() {};
c.doit = true;
c.caretOffset = -1;
@@ -207,21 +204,21 @@
c.length = 0;
c.offset = offset;
c.text=text0;
-
+
strategy.customizeDocumentCommand(temp, c);
-
+
//execute
temp.replace(c.offset, c.length, c.text);
-
+
temp.stopRewriteSession(session);
-
+
String textOut = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/my_test1_out.py" );
-
- Document d2 = new Document (textOut);
+
+ Document d2 = new Document (textOut);
assertIndentingEquals(d2, temp);
}
-
+
public void REM_testIndent07_pasting() throws Exception {
String textIn = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/my_test1_in.py" );
String text0 = "a = 5\n"+
@@ -242,9 +239,9 @@
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
-
- int offset = temp.getLineOffset(1) + 4;
-
+
+ int offset = temp.getLineOffset(1) + 4;
+
DocumentCommand c = new DocumentCommand() {};
c.doit = true;
c.caretOffset = -1;
@@ -252,32 +249,32 @@
c.length = 0;
c.offset = offset;
c.text=text0;
-
+
strategy.customizeDocumentCommand(temp, c);
-
+
//execute
temp.replace(c.offset, c.length, c.text);
-
+
temp.stopRewriteSession(session);
-
+
String textOut = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/my_test2_out.py" );
-
+
Document d2 = new Document (textOut);
-
+
assertIndentingEquals(d2, temp);
}
-/*
+/*
public void nottestIndent08_pasting() throws Exception {
- String textIn = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/test_builtin.py" );
+ String textIn = PythonUITestsPlugin.getDefault().getPluginFileContent( "/tests/test_builtin.py" );
Document temp = new Document("");
DocumentRewriteSession session = temp
.startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
installStuff(temp);
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
-
- int offset = 0;
-
+
+ int offset = 0;
+
DocumentCommand c = new DocumentCommand() {};
c.doit = true;
c.caretOffset = -1;
@@ -285,20 +282,20 @@
c.length = 0;
c.offset = offset;
c.text=textIn;
-
+
strategy.customizeDocumentCommand(temp, c);
-
+
//execute
temp.replace(c.offset, c.length, c.text);
-
+
temp.stopRewriteSession(session);
-
+
assertModelsEquals(textIn, temp.get());
}
-*/
-
+*/
+
private void assertIndentingEquals (IDocument exp, IDocument act) {
- int line = 0;
+ int line = 0;
//TODO: please, review this code
String fPartitioning = IPythonPartitions.PYTHON_PARTITIONING;
PythonAutoEditStrategy strategy = new PythonAutoEditStrategy(fStore, fPartitioning);
@@ -312,22 +309,22 @@
String ind2 = strategy.getLineIndent(s2);
if (strategy.getPhysicalLength(ind1) != strategy.getPhysicalLength(ind2))
System.out.println ("(line:" + line + ")\n"+s1 + "\nvs\n" + s2);
- assertEquals(strategy.getPhysicalLength(ind1), strategy.getPhysicalLength(ind2));
+ assertEquals(strategy.getPhysicalLength(ind1), strategy.getPhysicalLength(ind2));
}
- } catch (BadLocationException e) {
- }
+ } catch (BadLocationException e) {
+ }
}
/*
private void saveTempFile (String name, String content) {
- try {
+ try {
FileWriter wf = new FileWriter (name);
wf.write(content);
- wf.close();
+ wf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
-
+
private void assertModelsEquals (IModelElement e1, IModelElement e2) throws ModelException {
if (!(e1 instanceof ISourceModule)) {
assertEquals(e1.getElementName(), e2.getElementName());
@@ -358,11 +355,11 @@
}
}
}
-
+
private void assertModelsEquals (String src1, String src2) throws CoreException, IOException {
String prj = "prj0";
- IScriptProject project = this.setUpScriptProject(prj);
-
+ IScriptProject project = this.setUpScriptProject(prj);
+
saveTempFile (project.getPath().append("src1.py").makeRelative().toOSString(), src1);
saveTempFile (project.getPath().append("src2.py").makeRelative().toOSString(), src2);
ISourceModule module1 = this.getSourceModule(prj, "src", new Path("src1.py"));
@@ -371,5 +368,5 @@
assertModelsEquals(module1, module2);
deleteProject(prj);
}
-*/
+*/
}