use of com.android.ide.common.blame.Message in project android by JetBrains.
the class BuildOutputParserTest method redirectFileLinksOutput.
@Test
public void redirectFileLinksOutput() throws Exception {
// Do not run tests on Windows (see http://b.android.com/222904)
assumeFalse(SystemInfo.isWindows);
// Need file to be named (exactly) values.xml
File tempDir = Files.createTempDir();
File layoutDir = new File(tempDir, "layout-land");
layoutDir.mkdirs();
sourceFile = new File(layoutDir, "main.xml");
sourceFilePath = sourceFile.getAbsolutePath();
writeToFile("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + " android:orientation=\"vertical\"\n" + " android:layout_width=\"fill_parent\"\n" + " android:layout_height=\"fill_parent\"\n" + " >\n" + "<TextView\n" + " android:layout_width=\"fill_parent\"\n" + " android:layout_height=\"wrap_content\"\n" + " android:text=\"Test App - Basic\"\n" + " android:id=\"@+id/text\"\n" + " />\n" + "</LinearLayout>\n" + "\n" + "<!-- From: file:src/test/resources/testData/resources/incMergeData/filesVsValues/main/layout/main.xml -->");
String messageText = "Random error message here";
String err = sourceFilePath + ":4: error: Error: " + messageText;
Collection<Message> messages = parser.parseGradleOutput(err);
assertEquals(1, messages.size());
assertEquals("[message count]", 1, messages.size());
Message message = ContainerUtil.getFirstItem(messages);
assertNotNull(message);
// NOT sourceFilePath; should be translated back from source comment
String expected = "src/test/resources/testData/resources/incMergeData/filesVsValues/main/layout/main.xml";
assertEquals("[file path]", expected, getSystemIndependentSourcePath(message));
assertEquals("[message severity]", Message.Kind.ERROR, message.getKind());
assertEquals("[message text]", messageText, message.getText());
assertEquals("[position line]", 4, message.getLineNumber());
//assertEquals("[position column]", 35, message.getColumn());
// TODO: Test encoding issues (e.g. & in path where the XML source comment would be & instead)
}
use of com.android.ide.common.blame.Message in project android by JetBrains.
the class BuildOutputParserTest method parseDisplayingUnhandledMessages.
@Test
public void parseDisplayingUnhandledMessages() {
String output = " **--- HELLO WORLD ---**";
List<Message> Messages = parser.parseGradleOutput(output);
assertEquals(1, Messages.size());
Message message = Messages.get(0);
assertEquals(output, message.getText());
assertEquals(Message.Kind.SIMPLE, message.getKind());
}
Aggregations