Fix Java comment format.
TrimmedLines was copied from hidl-gen to do this, but we weren't using
it in the output.
For simplicity, this converts a single-line block comment to a
multi-line block comment.
Fixes: 202563750
Test: goldens
Change-Id: I2130a32702fb0bc87156363d9dc0e7e7edb57621
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index 78739b4..fd64309 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -4630,22 +4630,18 @@
{{{"/*\n"
" * Hello, world!\n"
" */"}},
- "/**\n"
- " * Hello, world!\n"
- " */"},
- {{{"/* @hide */"}}, "/** @hide */"},
+ "/** Hello, world! */\n"},
+ {{{"/* @hide */"}}, "/** @hide */\n"},
{{{"/**\n"
" @param foo ...\n"
"*/"}},
- "/**\n"
- " @param foo ...\n"
- "*/"},
- {{{"/* @hide */"}, {"/* @hide */"}}, "/* @hide *//** @hide */"},
+ "/** @param foo ... */\n"},
+ {{{"/* @hide */"}, {"/* @hide */"}}, "/* @hide */\n/** @hide */\n"},
{{{"/* @deprecated first */"}, {"/* @deprecated second */"}},
- "/* @deprecated first *//** @deprecated second */"},
- {{{"/* @deprecated */"}, {"/** @param foo */"}}, "/* @deprecated *//** @param foo */"},
+ "/* @deprecated first */\n/** @deprecated second */\n"},
+ {{{"/* @deprecated */"}, {"/** @param foo */"}}, "/* @deprecated */\n/** @param foo */\n"},
// Line comments are printed as they are
- {{{"/* @deprecated */"}, {"// line comments\n"}}, "/* @deprecated */// line comments\n"},
+ {{{"/* @deprecated */"}, {"// line comments\n"}}, "/* @deprecated */\n// line comments\n"},
};
for (const auto& [input, formatted] : testcases) {
EXPECT_EQ(formatted, FormatCommentsForJava(input));