aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 0150b43..ffeb53d9 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -2168,6 +2168,38 @@ TEST_F(FormatTestJS, JSDocAnnotations) {
getGoogleJSStyleWithColumns(20)));
}
+TEST_F(FormatTestJS, TslintComments) {
+ // tslint uses pragma comments that must be on their own line.
+ verifyFormat("// Comment that needs wrapping. Comment that needs wrapping. "
+ "Comment that needs\n"
+ "// wrapping. Trailing line.\n"
+ "// tslint:disable-next-line:must-be-on-own-line",
+ "// Comment that needs wrapping. Comment that needs wrapping. "
+ "Comment that needs wrapping.\n"
+ "// Trailing line.\n"
+ "// tslint:disable-next-line:must-be-on-own-line");
+}
+
+TEST_F(FormatTestJS, TscComments) {
+ // As above, @ts-ignore and @ts-check comments must be on their own line.
+ verifyFormat("// Comment that needs wrapping. Comment that needs wrapping. "
+ "Comment that needs\n"
+ "// wrapping. Trailing line.\n"
+ "// @ts-ignore",
+ "// Comment that needs wrapping. Comment that needs wrapping. "
+ "Comment that needs wrapping.\n"
+ "// Trailing line.\n"
+ "// @ts-ignore");
+ verifyFormat("// Comment that needs wrapping. Comment that needs wrapping. "
+ "Comment that needs\n"
+ "// wrapping. Trailing line.\n"
+ "// @ts-check",
+ "// Comment that needs wrapping. Comment that needs wrapping. "
+ "Comment that needs wrapping.\n"
+ "// Trailing line.\n"
+ "// @ts-check");
+}
+
TEST_F(FormatTestJS, RequoteStringsSingle) {
verifyFormat("var x = 'foo';", "var x = \"foo\";");
verifyFormat("var x = 'fo\\'o\\'';", "var x = \"fo'o'\";");