1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-01-23 10:05:51 -08:00
parent 815d32990c
commit 6878112781
9 changed files with 443 additions and 495 deletions

View file

@ -8,10 +8,6 @@
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*******************************************************************************/ *******************************************************************************/
/*
* Created on Sept 28, 2004
*/
package org.eclipse.cdt.core.parser.tests; package org.eclipse.cdt.core.parser.tests;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -41,7 +37,7 @@ public class FileBasePluginTest extends TestCase {
static IWorkspace workspace; static IWorkspace workspace;
static IProject project; static IProject project;
static FileManager fileManager; static FileManager fileManager;
static int numProjects = 0; static int numProjects;
static Class className; static Class className;
static ICProject cPrj; static ICProject cPrj;
@ -52,8 +48,8 @@ public class FileBasePluginTest extends TestCase {
super(name); super(name);
} }
private void initialize(Class aClassName){ private void initialize(Class aClassName) {
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){ if (CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null) {
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset(); //(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
@ -68,8 +64,8 @@ public class FileBasePluginTest extends TestCase {
className = aClassName; className = aClassName;
numProjects++; numProjects++;
} }
} catch ( CoreException e ) { } catch (CoreException e) {
/*boo*/ // Ignore
} }
if (project == null) if (project == null)
throw new NullPointerException("Unable to create project"); //$NON-NLS-1$ throw new NullPointerException("Unable to create project"); //$NON-NLS-1$
@ -79,8 +75,7 @@ public class FileBasePluginTest extends TestCase {
} }
} }
public FileBasePluginTest(String name, Class className) public FileBasePluginTest(String name, Class className) {
{
super(name); super(name);
initialize(className); initialize(className);
} }
@ -88,72 +83,56 @@ public class FileBasePluginTest extends TestCase {
public void cleanupProject() throws Exception { public void cleanupProject() throws Exception {
numProjects--; numProjects--;
try{ try {
if (numProjects == 0) { if (numProjects == 0) {
project.delete( true, false, monitor ); project.delete(true, false, monitor);
project = null; project = null;
} }
} catch( Throwable e ){ } catch (Throwable e) {
/*boo*/ // Ignore
} }
} }
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
if( project == null || !project.exists() ) if (project == null || !project.exists())
return; return;
IResource [] members = project.members(); IResource [] members = project.members();
for( int i = 0; i < members.length; i++ ){ for (int i = 0; i < members.length; i++) {
if( members[i].getName().equals( ".project" ) || members[i].getName().equals( ".cproject" ) ) //$NON-NLS-1$ //$NON-NLS-2$ if (members[i].getName().equals(".project") || members[i].getName().equals(".cproject")) //$NON-NLS-1$ //$NON-NLS-2$
continue; continue;
if (members[i].getName().equals(".settings")) if (members[i].getName().equals(".settings"))
continue; continue;
try{ try {
members[i].delete( false, monitor ); members[i].delete(false, monitor);
} catch( Throwable e ){ } catch (Throwable e) {
/*boo*/ // Ignore
} }
} }
} }
// below can be used to work with large files (too large for memory)
// protected IFile importFile(String fileName) throws Exception {
// IFile file = cPrj.getProject().getFile(fileName);
// if (!file.exists()) {
// try{
// FileInputStream fileIn = new FileInputStream(
// CTestPlugin.getDefault().getFileInPlugin(new Path("resources/parser/" + fileName)));
// file.create(fileIn,false, monitor);
// } catch (CoreException e) {
// e.printStackTrace();
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// }
// }
//
// return file;
// }
protected IFolder importFolder(String folderName) throws Exception { protected IFolder importFolder(String folderName) throws Exception {
IFolder folder = project.getProject().getFolder(folderName); IFolder folder = project.getProject().getFolder(folderName);
//Create file input stream // Create file input stream
if( !folder.exists() ) if (!folder.exists())
folder.create( false, false, monitor ); folder.create(false, false, monitor);
return folder; return folder;
} }
public IFile importFile(String fileName, String contents ) throws Exception{
//Obtain file handle public IFile importFile(String fileName, String contents) throws Exception {
// Obtain file handle
IFile file = project.getProject().getFile(fileName); IFile file = project.getProject().getFile(fileName);
InputStream stream = new ByteArrayInputStream( contents.getBytes() ); InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream // Create file input stream
if( file.exists() ) if (file.exists()) {
file.setContents( stream, false, false, monitor ); file.setContents(stream, false, false, monitor);
else } else {
file.create( stream, false, monitor ); file.create(stream, false, monitor);
}
fileManager.addFile(file); fileManager.addFile(file);

View file

@ -8,10 +8,6 @@
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*******************************************************************************/ *******************************************************************************/
/*
* Created on Sept 28, 2004
*/
package org.eclipse.cdt.core.parser.tests.ast2; package org.eclipse.cdt.core.parser.tests.ast2;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -44,7 +40,7 @@ public class AST2FileBasePluginTest extends TestCase {
static IWorkspace workspace; static IWorkspace workspace;
static IProject project; static IProject project;
static FileManager fileManager; static FileManager fileManager;
static int numProjects = 0; static int numProjects;
static Class className; static Class className;
static ICProject cPrj; static ICProject cPrj;
@ -55,8 +51,8 @@ public class AST2FileBasePluginTest extends TestCase {
super(name); super(name);
} }
private void initialize(Class aClassName){ private void initialize(Class aClassName) {
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){ if (CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null) {
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset(); //(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
@ -72,19 +68,18 @@ public class AST2FileBasePluginTest extends TestCase {
className = aClassName; className = aClassName;
numProjects++; numProjects++;
} }
} catch ( CoreException e ) { } catch (CoreException e) {
/*boo*/ // Ignore
} }
if (project == null) if (project == null)
throw new NullPointerException("Unable to create project"); //$NON-NLS-1$ throw new NullPointerException("Unable to create project"); //$NON-NLS-1$
//Create file manager // Create file manager
fileManager = new FileManager(); fileManager = new FileManager();
} }
} }
public AST2FileBasePluginTest(String name, Class className) public AST2FileBasePluginTest(String name, Class className) {
{
super(name); super(name);
initialize(className); initialize(className);
} }
@ -92,31 +87,31 @@ public class AST2FileBasePluginTest extends TestCase {
public void cleanupProject() throws Exception { public void cleanupProject() throws Exception {
numProjects--; numProjects--;
try{ try {
if (numProjects == 0) { if (numProjects == 0) {
project.delete( true, false, monitor ); project.delete(true, false, monitor);
project = null; project = null;
} }
} catch( Throwable e ){ } catch (Throwable e) {
/*boo*/ // Ignore
} }
} }
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
if( project == null || !project.exists() ) if (project == null || !project.exists())
return; return;
IResource [] members = project.members(); IResource[] members = project.members();
for( int i = 0; i < members.length; i++ ){ for (int i = 0; i < members.length; i++) {
if( members[i].getName().equals( ".project" ) || members[i].getName().equals( ".cproject" ) ) //$NON-NLS-1$ //$NON-NLS-2$ if (members[i].getName().equals(".project") || members[i].getName().equals(".cproject")) //$NON-NLS-1$ //$NON-NLS-2$
continue; continue;
if (members[i].getName().equals(".settings")) if (members[i].getName().equals(".settings"))
continue; continue;
try{ try {
members[i].delete( false, monitor ); members[i].delete(false, monitor);
} catch( Throwable e ){ } catch (Throwable e) {
/*boo*/ // Ignore
} }
} }
} }
@ -124,22 +119,24 @@ public class AST2FileBasePluginTest extends TestCase {
protected IFolder importFolder(String folderName) throws Exception { protected IFolder importFolder(String folderName) throws Exception {
IFolder folder = project.getProject().getFolder(folderName); IFolder folder = project.getProject().getFolder(folderName);
//Create file input stream // Create file input stream
if( !folder.exists() ) if (!folder.exists())
folder.create( false, false, monitor ); folder.create(false, false, monitor);
return folder; return folder;
} }
public IFile importFile(String fileName, String contents ) throws Exception{
//Obtain file handle public IFile importFile(String fileName, String contents) throws Exception {
// Obtain file handle
IFile file = project.getProject().getFile(fileName); IFile file = project.getProject().getFile(fileName);
InputStream stream = new ByteArrayInputStream( contents.getBytes() ); InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream // Create file input stream
if( file.exists() ) if (file.exists()) {
file.setContents( stream, false, false, monitor ); file.setContents(stream, false, false, monitor);
else } else {
file.create( stream, false, monitor ); file.create(stream, false, monitor);
}
fileManager.addFile(file); fileManager.addFile(file);
@ -150,5 +147,4 @@ public class AST2FileBasePluginTest extends TestCase {
return TestSourceReader.getContentsForTest( return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections); CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
} }
} }

View file

@ -6685,7 +6685,8 @@ public class AST2TemplateTests extends AST2BaseTest {
BindingAssertionHelper assertionHelper = getAssertionHelper(); BindingAssertionHelper assertionHelper = getAssertionHelper();
ICPPAliasTemplateInstance AliasInt = assertionHelper.assertNonProblem("Alias<int> intAlias;", "Alias<int>", ICPPAliasTemplateInstance.class); ICPPAliasTemplateInstance AliasInt =
assertionHelper.assertNonProblem("Alias<int> intAlias;", "Alias<int>", ICPPAliasTemplateInstance.class);
assertEquals("Alias<int>", AliasInt.getName()); assertEquals("Alias<int>", AliasInt.getName());
assertEquals("NS", AliasInt.getQualifiedName()[0]); assertEquals("NS", AliasInt.getQualifiedName()[0]);
assertEquals("Alias<int>", AliasInt.getQualifiedName()[1]); assertEquals("Alias<int>", AliasInt.getQualifiedName()[1]);

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Nathan Ridge * Nathan Ridge
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2; package org.eclipse.cdt.core.parser.tests.ast2;

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Nathan Ridge * Nathan Ridge
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2; package org.eclipse.cdt.core.parser.tests.ast2;
@ -38,7 +38,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.model.CProject; import org.eclipse.cdt.internal.core.model.CProject;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
@ -58,8 +57,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
super(name, DOMSelectionParseTest.class); super(name, DOMSelectionParseTest.class);
} }
public void testBaseCase_VariableReference() throws Exception public void testBaseCase_VariableReference() throws Exception {
{
String code = "void f() { int x; x=3; }"; //$NON-NLS-1$ String code = "void f() { int x; x=3; }"; //$NON-NLS-1$
int offset1 = code.indexOf( "x=" ); //$NON-NLS-1$ int offset1 = code.indexOf( "x=" ); //$NON-NLS-1$
int offset2 = code.indexOf( '='); int offset2 = code.indexOf( '=');
@ -74,8 +72,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 1); assertEquals( ((ASTNode)decls[0]).getLength(), 1);
} }
public void testBaseCase_FunctionReference() throws Exception public void testBaseCase_FunctionReference() throws Exception {
{
String code = "int x(){x( );}"; //$NON-NLS-1$ String code = "int x(){x( );}"; //$NON-NLS-1$
int offset1 = code.indexOf( "x( " ); //$NON-NLS-1$ int offset1 = code.indexOf( "x( " ); //$NON-NLS-1$
int offset2 = code.indexOf( "( )"); //$NON-NLS-1$ int offset2 = code.indexOf( "( )"); //$NON-NLS-1$
@ -90,16 +87,14 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 1); assertEquals( ((ASTNode)decls[0]).getLength(), 1);
} }
public void testBaseCase_Error() throws Exception public void testBaseCase_Error() throws Exception {
{
String code = "int x() { y( ) }"; //$NON-NLS-1$ String code = "int x() { y( ) }"; //$NON-NLS-1$
int offset1 = code.indexOf( "y( " ); //$NON-NLS-1$ int offset1 = code.indexOf( "y( " ); //$NON-NLS-1$
int offset2 = code.indexOf( "( )"); //$NON-NLS-1$ int offset2 = code.indexOf( "( )"); //$NON-NLS-1$
assertNull( parse( code, offset1, offset2, false )); assertNull( parse( code, offset1, offset2, false ));
} }
public void testBaseCase_FunctionDeclaration() throws Exception public void testBaseCase_FunctionDeclaration() throws Exception {
{
String code = "int x(); void test() {x( );}"; //$NON-NLS-1$ String code = "int x(); void test() {x( );}"; //$NON-NLS-1$
int offset1 = code.indexOf( "x( )" ); //$NON-NLS-1$ int offset1 = code.indexOf( "x( )" ); //$NON-NLS-1$
int offset2 = code.indexOf( "( )"); //$NON-NLS-1$ int offset2 = code.indexOf( "( )"); //$NON-NLS-1$
@ -114,8 +109,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 1); assertEquals( ((ASTNode)decls[0]).getLength(), 1);
} }
public void testBaseCase_FunctionDeclaration2() throws Exception public void testBaseCase_FunctionDeclaration2() throws Exception {
{
String code = "int printf( const char *, ... ); "; //$NON-NLS-1$ String code = "int printf( const char *, ... ); "; //$NON-NLS-1$
int offset1 = code.indexOf( "printf" ); //$NON-NLS-1$ int offset1 = code.indexOf( "printf" ); //$NON-NLS-1$
int offset2 = code.indexOf( "( const"); //$NON-NLS-1$ int offset2 = code.indexOf( "( const"); //$NON-NLS-1$
@ -125,8 +119,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((IASTName)node).toString(), "printf" ); //$NON-NLS-1$ assertEquals( ((IASTName)node).toString(), "printf" ); //$NON-NLS-1$
} }
public void testBaseCase_VariableDeclaration() throws Exception public void testBaseCase_VariableDeclaration() throws Exception {
{
String code = "int x = 3;"; //$NON-NLS-1$ String code = "int x = 3;"; //$NON-NLS-1$
int offset1 = code.indexOf( "x" ); //$NON-NLS-1$ int offset1 = code.indexOf( "x" ); //$NON-NLS-1$
int offset2 = code.indexOf( " ="); //$NON-NLS-1$ int offset2 = code.indexOf( " ="); //$NON-NLS-1$
@ -137,8 +130,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$ assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$
} }
public void testBaseCase_Parameter() throws Exception public void testBaseCase_Parameter() throws Exception {
{
String code = "int main( int argc ) { int x = argc; }"; //$NON-NLS-1$ String code = "int main( int argc ) { int x = argc; }"; //$NON-NLS-1$
int offset1 = code.indexOf( "argc;" ); //$NON-NLS-1$ int offset1 = code.indexOf( "argc;" ); //$NON-NLS-1$
int offset2 = code.indexOf( ";" ); //$NON-NLS-1$ int offset2 = code.indexOf( ";" ); //$NON-NLS-1$
@ -154,8 +146,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 4); assertEquals( ((ASTNode)decls[0]).getLength(), 4);
} }
public void testBug57898() throws Exception public void testBug57898() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Gonzo { public: void playHorn(); };\n" ); //$NON-NLS-1$ writer.write( "class Gonzo { public: void playHorn(); };\n" ); //$NON-NLS-1$
writer.write( "void Gonzo::playHorn() { return; }\n" ); //$NON-NLS-1$ writer.write( "void Gonzo::playHorn() { return; }\n" ); //$NON-NLS-1$
@ -190,8 +181,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
} }
} }
public void testConstructorDestructorDeclaration() throws Exception public void testConstructorDestructorDeclaration() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Gonzo { Gonzo(); ~Gonzo(); };"); //$NON-NLS-1$ writer.write( "class Gonzo { Gonzo(); ~Gonzo(); };"); //$NON-NLS-1$
String code = writer.toString(); String code = writer.toString();
@ -209,8 +199,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((IASTName)node).toString(), "~Gonzo" ); //$NON-NLS-1$ assertEquals( ((IASTName)node).toString(), "~Gonzo" ); //$NON-NLS-1$
} }
public void testBug60264() throws Exception public void testBug60264() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "namespace Muppets { int i; }\n" ); //$NON-NLS-1$ writer.write( "namespace Muppets { int i; }\n" ); //$NON-NLS-1$
writer.write( "int main(int argc, char **argv) { Muppets::i = 1; }\n" ); //$NON-NLS-1$ writer.write( "int main(int argc, char **argv) { Muppets::i = 1; }\n" ); //$NON-NLS-1$
@ -239,8 +228,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 7); assertEquals( ((ASTNode)decls[0]).getLength(), 7);
} }
public void testBug61613() throws Exception public void testBug61613() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Foo { // ** (A) **\n" ); //$NON-NLS-1$ writer.write( "class Foo { // ** (A) **\n" ); //$NON-NLS-1$
writer.write( " public:\n" ); //$NON-NLS-1$ writer.write( " public:\n" ); //$NON-NLS-1$
@ -263,8 +251,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 3); assertEquals( ((ASTNode)decls[0]).getLength(), 3);
} }
public void testBug60038() throws Exception public void testBug60038() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Gonzo {\n"); //$NON-NLS-1$ writer.write( "class Gonzo {\n"); //$NON-NLS-1$
writer.write( "public:\n"); //$NON-NLS-1$ writer.write( "public:\n"); //$NON-NLS-1$
@ -339,8 +326,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
} }
} }
public void testMethodReference() throws Exception public void testMethodReference() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Sample { public:\n"); //$NON-NLS-1$ writer.write( "class Sample { public:\n"); //$NON-NLS-1$
writer.write( " int getAnswer() const;\n"); //$NON-NLS-1$ writer.write( " int getAnswer() const;\n"); //$NON-NLS-1$
@ -362,8 +348,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 9); assertEquals( ((ASTNode)decls[0]).getLength(), 9);
} }
public void testConstructorDefinition() throws Exception public void testConstructorDefinition() throws Exception {
{
String code = "class ABC { public: ABC(); }; ABC::ABC(){}"; //$NON-NLS-1$ String code = "class ABC { public: ABC(); }; ABC::ABC(){}"; //$NON-NLS-1$
int startIndex = code.indexOf( "::ABC") + 2; //$NON-NLS-1$ int startIndex = code.indexOf( "::ABC") + 2; //$NON-NLS-1$
IASTNode node = parse( code, startIndex, startIndex + 3 ); IASTNode node = parse( code, startIndex, startIndex + 3 );
@ -377,8 +362,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 3); assertEquals( ((ASTNode)decls[0]).getLength(), 3);
} }
public void testBug63966() throws Exception public void testBug63966() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "void foo(int a) {}\n" ); //$NON-NLS-1$ writer.write( "void foo(int a) {}\n" ); //$NON-NLS-1$
writer.write( "void foo(long a) {}\n" ); //$NON-NLS-1$ writer.write( "void foo(long a) {}\n" ); //$NON-NLS-1$
@ -389,8 +373,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
parse( code, startIndex, startIndex + 3 ); parse( code, startIndex, startIndex + 3 );
} }
public void testBug66744() throws Exception public void testBug66744() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "enum EColours { RED, GREEN, BLUE }; \n" ); //$NON-NLS-1$ writer.write( "enum EColours { RED, GREEN, BLUE }; \n" ); //$NON-NLS-1$
writer.write( "void foo() { EColours color = GREEN; } \n" ); //$NON-NLS-1$ writer.write( "void foo() { EColours color = GREEN; } \n" ); //$NON-NLS-1$
@ -402,8 +385,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
public void testBug68527() throws Exception public void testBug68527() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write("struct X;\n"); //$NON-NLS-1$ writer.write("struct X;\n"); //$NON-NLS-1$
writer.write("struct X anA;"); //$NON-NLS-1$ writer.write("struct X anA;"); //$NON-NLS-1$
@ -412,8 +394,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
parse( code, startIndex, startIndex + 1 ); parse( code, startIndex, startIndex + 1 );
} }
public void testBug60407() throws Exception public void testBug60407() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "struct ZZZ { int x, y, z; };\n" ); //$NON-NLS-1$ writer.write( "struct ZZZ { int x, y, z; };\n" ); //$NON-NLS-1$
writer.write( "typedef struct ZZZ _FILE;\n" ); //$NON-NLS-1$ writer.write( "typedef struct ZZZ _FILE;\n" ); //$NON-NLS-1$
@ -429,8 +410,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
parse( code, startIndex, startIndex + "static_function".length() ); //$NON-NLS-1$ parse( code, startIndex, startIndex + "static_function".length() ); //$NON-NLS-1$
} }
public void testBug61800() throws Exception public void testBug61800() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class B {};\n"); //$NON-NLS-1$ writer.write( "class B {};\n"); //$NON-NLS-1$
writer.write( "class ABCDEF {\n"); //$NON-NLS-1$ writer.write( "class ABCDEF {\n"); //$NON-NLS-1$
@ -450,8 +430,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 5); assertEquals( ((ASTNode)decls[0]).getLength(), 5);
} }
public void testBug68739() throws Exception public void testBug68739() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "int fprintf( int *, const char *, ... ); \n" ); //$NON-NLS-1$ writer.write( "int fprintf( int *, const char *, ... ); \n" ); //$NON-NLS-1$
writer.write( "void boo( int * lcd ) { \n" ); //$NON-NLS-1$ writer.write( "void boo( int * lcd ) { \n" ); //$NON-NLS-1$
@ -468,8 +447,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((IASTName)node).toString(), "fprintf" ); //$NON-NLS-1$ assertEquals( ((IASTName)node).toString(), "fprintf" ); //$NON-NLS-1$
} }
public void testBug72818() throws Exception public void testBug72818() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "union Squaw { int x; double u; };\n" ); //$NON-NLS-1$ writer.write( "union Squaw { int x; double u; };\n" ); //$NON-NLS-1$
writer.write( "int main(int argc, char **argv) {\n" ); //$NON-NLS-1$ writer.write( "int main(int argc, char **argv) {\n" ); //$NON-NLS-1$
@ -489,8 +467,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 5); assertEquals( ((ASTNode)decls[0]).getLength(), 5);
} }
public void test72220() throws Exception public void test72220() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "const int FOUND_ME = 1;\n" ); //$NON-NLS-1$ writer.write( "const int FOUND_ME = 1;\n" ); //$NON-NLS-1$
writer.write( "class Test{\n" ); //$NON-NLS-1$ writer.write( "class Test{\n" ); //$NON-NLS-1$
@ -671,8 +648,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
// assertEquals( ((ASTNode)decls[0]).getLength(), 3); // assertEquals( ((ASTNode)decls[0]).getLength(), 3);
} }
public void testBug72710() throws Exception public void testBug72710() throws Exception {
{
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Card{\n" ); //$NON-NLS-1$ writer.write( "class Card{\n" ); //$NON-NLS-1$
writer.write( " Card( int rank );\n" ); //$NON-NLS-1$ writer.write( " Card( int rank );\n" ); //$NON-NLS-1$
@ -1643,8 +1619,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 1); assertEquals( ((ASTNode)decls[0]).getLength(), 1);
} }
public void testBug64181() throws Exception public void testBug64181() throws Exception {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("namespace Foo { // ** (A) **\n"); //$NON-NLS-1$ buffer.append("namespace Foo { // ** (A) **\n"); //$NON-NLS-1$
buffer.append("int bar;\n"); //$NON-NLS-1$ buffer.append("int bar;\n"); //$NON-NLS-1$
@ -1673,8 +1648,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[1]).getLength(), 3); assertEquals( ((ASTNode)decls[1]).getLength(), 3);
} }
public void testBug80823() throws Exception public void testBug80823() throws Exception {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("class MyEggImpl {}; // line A\n"); //$NON-NLS-1$ buffer.append("class MyEggImpl {}; // line A\n"); //$NON-NLS-1$
buffer.append("#define MyChicken MyEggImpl\n"); //$NON-NLS-1$ buffer.append("#define MyChicken MyEggImpl\n"); //$NON-NLS-1$
@ -1694,8 +1668,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals( ((ASTNode)decls[0]).getLength(), 9); assertEquals( ((ASTNode)decls[0]).getLength(), 9);
} }
public void testBug86993() throws Exception public void testBug86993() throws Exception {
{
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("#define _BEGIN_STD_C extern \"C\" {\n"); //$NON-NLS-1$ buffer.append("#define _BEGIN_STD_C extern \"C\" {\n"); //$NON-NLS-1$
buffer.append("#define _END_STD_C }\n"); //$NON-NLS-1$ buffer.append("#define _END_STD_C }\n"); //$NON-NLS-1$
@ -1736,4 +1709,3 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
assertEquals(length, loc.getNodeLength()); assertEquals(length, loc.getNodeLength());
} }
} }