mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
ba4c7c1e04
commit
e290bc4877
1 changed files with 27 additions and 28 deletions
|
@ -9,7 +9,6 @@
|
|||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.testplugin.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -69,7 +68,8 @@ public class TestSourceReader {
|
|||
* test in the source code.
|
||||
* @throws IOException
|
||||
*/
|
||||
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, final String testName, int sections) throws IOException {
|
||||
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
|
||||
final String testName, int sections) throws IOException {
|
||||
String fqn = clazz.getName().replace('.', '/');
|
||||
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
|
||||
String classFile = fqn + ".java";
|
||||
|
@ -77,9 +77,9 @@ public class TestSourceReader {
|
|||
|
||||
InputStream in;
|
||||
try {
|
||||
if (bundle != null)
|
||||
if (bundle != null) {
|
||||
in = FileLocator.openStream(bundle, filePath, false);
|
||||
else {
|
||||
} else {
|
||||
in = clazz.getResourceAsStream('/' + classFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -91,7 +91,7 @@ public class TestSourceReader {
|
|||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
List contents = new ArrayList();
|
||||
List<StringBuilder> contents = new ArrayList<StringBuilder>();
|
||||
StringBuilder content = new StringBuilder();
|
||||
for (String line = br.readLine(); line != null; line = br.readLine()) {
|
||||
line = line.replaceFirst("^\\s*", ""); // replace leading whitespace, preserve trailing
|
||||
|
@ -106,7 +106,7 @@ public class TestSourceReader {
|
|||
}
|
||||
int idx= line.indexOf(testName);
|
||||
if (idx != -1 && !Character.isJavaIdentifierPart(line.charAt(idx + testName.length()))) {
|
||||
return (StringBuilder[]) contents.toArray(new StringBuilder[contents.size()]);
|
||||
return contents.toArray(new StringBuilder[contents.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,8 +207,7 @@ public class TestSourceReader {
|
|||
}
|
||||
line= reader.readLine();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
Assert.assertTrue("Tag '" + tag + "' is not defined inside of '" + filePath + "'.", found);
|
||||
|
|
Loading…
Add table
Reference in a new issue