- 40257: parsing of "../" paths in LST files is broken Added interactive test for checking compiler task list messages (via browser).tags/V1_1_1
@@ -25,15 +25,15 @@ import org.aspectj.ajde.*; | |||
/** | |||
* @author Mik Kersten | |||
*/ | |||
public class BrowserManagerTest extends TestCase { | |||
public class InteractiveBrowserTest extends TestCase { | |||
public BrowserManagerTest(String name) { | |||
public InteractiveBrowserTest(String name) { | |||
super(name); | |||
} | |||
public static TestSuite suite() { | |||
TestSuite result = new TestSuite(); | |||
result.addTestSuite(BrowserManagerTest.class); | |||
result.addTestSuite(InteractiveBrowserTest.class); | |||
return result; | |||
} | |||
@@ -49,16 +49,19 @@ public class BrowserManagerTest extends TestCase { | |||
"project-level task", | |||
IMessage.ERROR); | |||
BrowserManager.getDefault().showMessages(); | |||
assertTrue("confirmation result", verifySuccess("Project task is visible.")); | |||
} | |||
public void testAddSourceLineTasks() { | |||
BrowserManager.getDefault().init(new String[]{}, true); | |||
ISourceLocation dummyLocation = new SourceLocation(new File("<file>"), -1, -1); | |||
ISourceLocation dummyLocation = new SourceLocation(new File("<file>"), 0, 0); | |||
Ajde.getDefault().getTaskListManager().addSourcelineTask( | |||
"error task", | |||
dummyLocation, | |||
IMessage.ERROR); | |||
IMessage.ERROR); | |||
Ajde.getDefault().getTaskListManager().addSourcelineTask( | |||
"warning task", | |||
@@ -69,6 +72,8 @@ public class BrowserManagerTest extends TestCase { | |||
"info task", | |||
dummyLocation, | |||
IMessage.INFO); | |||
BrowserManager.getDefault().showMessages(); | |||
assertTrue("confirmation result", verifySuccess("3 kinds of sourceline tasks are visible.")); | |||
} |
@@ -57,7 +57,7 @@ public class CompilerMessagesCellRenderer extends JLabel implements ListCellRend | |||
} else if (IMessage.ERROR.isSameOrLessThan(kind)) { | |||
setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon()); | |||
} else { | |||
setIcon(null); | |||
setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon()); | |||
} | |||
if (isSelected) { | |||
setBackground(list.getSelectionBackground()); |
@@ -0,0 +1,6 @@ | |||
package d1; | |||
public class A { | |||
} |
@@ -0,0 +1,3 @@ | |||
package d1.d2; | |||
class B { } |
@@ -0,0 +1,3 @@ | |||
A.java | |||
d2/B.java | |||
../d3/C.java |
@@ -0,0 +1,3 @@ | |||
package d3; | |||
class C { } |
@@ -25,7 +25,7 @@ public class AjdtAjcTests extends TestCase { | |||
suite.addTestSuite(BuildArgParserTestCase.class); | |||
suite.addTestSuite(ConsoleMessageHandlerTestCase.class); | |||
//$JUnit-END$ | |||
return suite; | |||
return suite; | |||
} | |||
public AjdtAjcTests(String name) { super(name); } |
@@ -12,23 +12,17 @@ | |||
package org.aspectj.ajdt.ajc; | |||
import org.aspectj.ajdt.internal.core.builder.AjBuildConfig; | |||
import org.aspectj.ajdt.internal.core.builder.AjCompilerOptions; | |||
import java.io.*; | |||
import java.util.*; | |||
import junit.framework.TestCase; | |||
import org.aspectj.ajdt.internal.core.builder.*; | |||
import org.aspectj.bridge.MessageWriter; | |||
import org.aspectj.testing.util.TestUtil; | |||
import org.eclipse.jdt.core.compiler.InvalidInputException; | |||
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; | |||
import java.io.File; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import java.io.PrintWriter; | |||
import java.util.Arrays; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import junit.framework.TestCase; | |||
/** | |||
* Some black-box test is happening here. | |||
*/ | |||
@@ -328,6 +322,23 @@ public class BuildArgParserTestCase extends TestCase { | |||
assertEquals(outputDir.getPath(), OUT_PATH); | |||
} | |||
public void testNonExistentConfigFile() throws IOException { | |||
String FILE_PATH = "@" + TEST_DIR + "../bug-40257/d1/test.lst"; | |||
AjBuildConfig config = parser.genBuildConfig(new String[] { FILE_PATH }, messageWriter); | |||
String a = new File(TEST_DIR + "../bug-40257/d1/A.java").getCanonicalPath(); | |||
String b = new File(TEST_DIR + "../bug-40257/d1/d2/B.java").getCanonicalPath(); | |||
String c = new File(TEST_DIR + "../bug-40257/d3/C.java").getCanonicalPath(); | |||
List pathList = new ArrayList(); | |||
for (Iterator it = config.getFiles().iterator(); it.hasNext(); ) { | |||
pathList.add(((File)it.next()).getCanonicalPath()); | |||
} | |||
assertTrue(pathList.contains(a)); | |||
assertTrue(pathList.contains(b)); | |||
assertTrue(pathList.contains(c)); | |||
} | |||
public void testXlint() throws InvalidInputException { | |||
AjdtCommand command = new AjdtCommand(); | |||
AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlint"}, messageWriter); |