data: error for java import not found

* added recording an error in this case.
* added test for this case.
This commit is contained in:
malte_langkabel
2016-08-17 17:04:23 +02:00
parent a3001b2b72
commit 3d40f4ed4e
2 changed files with 17 additions and 0 deletions
@@ -401,6 +401,13 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
);
}
}
else
{
JavaIndexer.recordError(
m_callbackId, "Import not found.", true, true,
nameExpr.getBeginLine(), nameExpr.getBeginColumn(), nameExpr.getEndLine(), nameExpr.getEndColumn()
);
}
}
catch (Exception e)
{
+10
View File
@@ -314,6 +314,16 @@ public:
TS_ASSERT_EQUALS(client->errors[0], "Encountered unexpected token. <1:1 1:7>");
}
void test_java_parser_finds_missing_import_as_error()
{
std::shared_ptr<TestParserClient> client = parseCode(
"import foo;\n"
);
TS_ASSERT_EQUALS(client->errors.size(), 1);
TS_ASSERT_EQUALS(client->errors[0], "Import not found. <1:8 1:10>");
}