taymonbeal updated this revision to Diff 506153.
taymonbeal added a comment.

Add release notes and unit test in TokenAnnotatorTest.cpp


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146247/new/

https://reviews.llvm.org/D146247

Files:
  clang/docs/ReleaseNotes.rst
  clang/unittests/Format/TokenAnnotatorTest.cpp


Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===================================================================
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -1434,6 +1434,20 @@
   EXPECT_TOKEN(Tokens[13], tok::l_brace, TT_FunctionLBrace);
 }
 
+TEST_F(TokenAnnotatorTest, UnderstandsTypeScriptSatisfiesOperator) {
+  auto Tokens = annotate("let x = foo satisfies Type;",
+                         getGoogleStyle(FormatStyle::LK_JavaScript));
+  ASSERT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[0], tok::identifier, TT_Unknown);
+  EXPECT_TOKEN(Tokens[1], tok::identifier, TT_StartOfName);
+  EXPECT_TOKEN(Tokens[2], tok::equal, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[3], tok::identifier, TT_Unknown);
+  EXPECT_TOKEN(Tokens[4], tok::identifier, TT_StartOfName);
+  EXPECT_TOKEN(Tokens[5], tok::identifier, TT_Unknown);
+  EXPECT_TOKEN(Tokens[6], tok::semi, TT_Unknown);
+  EXPECT_TOKEN(Tokens[7], tok::eof, TT_Unknown);
+}
+
 } // namespace
 } // namespace format
 } // namespace clang
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -326,6 +326,7 @@
   Compared to ``NextLine`` style, ``NextLineOnly`` style will not try to
   put the initializers on the current line first, instead, it will try to
   put the initializers on the next line only.
+- Add support for the ``satisfies`` operator introduced in TypeScript 4.9.
 
 libclang
 --------


Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===================================================================
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -1434,6 +1434,20 @@
   EXPECT_TOKEN(Tokens[13], tok::l_brace, TT_FunctionLBrace);
 }
 
+TEST_F(TokenAnnotatorTest, UnderstandsTypeScriptSatisfiesOperator) {
+  auto Tokens = annotate("let x = foo satisfies Type;",
+                         getGoogleStyle(FormatStyle::LK_JavaScript));
+  ASSERT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[0], tok::identifier, TT_Unknown);
+  EXPECT_TOKEN(Tokens[1], tok::identifier, TT_StartOfName);
+  EXPECT_TOKEN(Tokens[2], tok::equal, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[3], tok::identifier, TT_Unknown);
+  EXPECT_TOKEN(Tokens[4], tok::identifier, TT_StartOfName);
+  EXPECT_TOKEN(Tokens[5], tok::identifier, TT_Unknown);
+  EXPECT_TOKEN(Tokens[6], tok::semi, TT_Unknown);
+  EXPECT_TOKEN(Tokens[7], tok::eof, TT_Unknown);
+}
+
 } // namespace
 } // namespace format
 } // namespace clang
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -326,6 +326,7 @@
   Compared to ``NextLine`` style, ``NextLineOnly`` style will not try to
   put the initializers on the current line first, instead, it will try to
   put the initializers on the next line only.
+- Add support for the ``satisfies`` operator introduced in TypeScript 4.9.
 
 libclang
 --------
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to