clang-format: [JS] test declared fields.
authorMartin Probst <martin@probst.io>
Thu, 7 Nov 2019 22:37:06 +0000 (23:37 +0100)
committerMartin Probst <martin@probst.io>
Mon, 11 Nov 2019 15:36:00 +0000 (16:36 +0100)
Summary:
TypeScript now supports declaring fields:

    class Foo {
      declare field: string;
    }

clang-format happens to already format this fine, so this change just
adds a regression test.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69972

clang/unittests/Format/FormatTestJS.cpp

index 30a0b37..619a19f 100644 (file)
@@ -2369,5 +2369,12 @@ TEST_F(FormatTestJS, SupportPrivateFieldsAndMethods) {
                "  static #staticPrivateMethod() {}\n");
 }
 
+TEST_F(FormatTestJS, DeclaredFields) {
+  verifyFormat("class Example {\n"
+               "  declare pub: string;\n"
+               "  declare private priv: string;\n"
+               "}\n");
+}
+
 } // namespace format
 } // end namespace clang