AAPT2: Forward @TestApi in resource comments to JavaDoc

Bug: 37894597
Test: make aapt2_tests
Change-Id: I357fb84941bfbb3892a8c46feb47f55b865b6649
This commit is contained in:
Adam Lesinski
2017-08-08 10:39:55 -07:00
parent b76b3056f5
commit 09f4d706d9
7 changed files with 186 additions and 190 deletions

View File

@@ -34,7 +34,7 @@ TEST(AnnotationProcessorTest, EmitsDeprecated) {
processor.AppendComment(comment);
std::stringstream result;
processor.WriteToStream(&result, "");
processor.WriteToStream("", &result);
std::string annotations = result.str();
EXPECT_THAT(annotations, HasSubstr("@Deprecated"));
@@ -45,7 +45,7 @@ TEST(AnnotationProcessorTest, EmitsSystemApiAnnotationAndRemovesFromComment) {
processor.AppendComment("@SystemApi This is a system API");
std::stringstream result;
processor.WriteToStream(&result, "");
processor.WriteToStream("", &result);
std::string annotations = result.str();
EXPECT_THAT(annotations, HasSubstr("@android.annotation.SystemApi"));
@@ -53,6 +53,19 @@ TEST(AnnotationProcessorTest, EmitsSystemApiAnnotationAndRemovesFromComment) {
EXPECT_THAT(annotations, HasSubstr("This is a system API"));
}
TEST(AnnotationProcessorTest, EmitsTestApiAnnotationAndRemovesFromComment) {
AnnotationProcessor processor;
processor.AppendComment("@TestApi This is a test API");
std::stringstream result;
processor.WriteToStream("", &result);
std::string annotations = result.str();
EXPECT_THAT(annotations, HasSubstr("@android.annotation.TestApi"));
EXPECT_THAT(annotations, Not(HasSubstr("@TestApi")));
EXPECT_THAT(annotations, HasSubstr("This is a test API"));
}
TEST(AnnotationProcessor, ExtractsFirstSentence) {
EXPECT_THAT(AnnotationProcessor::ExtractFirstSentence("This is the only sentence"),
Eq("This is the only sentence"));