Parcourir la source

clang-format source files. (#370)

Add some trailing `//`s to prevent clang-format from making some tests
unreadable.
Richard Smith il y a 5 ans
Parent
commit
df6f33c545
3 fichiers modifiés avec 57 ajouts et 58 suppressions
  1. 0 1
      lexer/string_literal.h
  2. 51 51
      lexer/string_literal_test.cpp
  3. 6 6
      lexer/tokenized_buffer_test.cpp

+ 0 - 1
lexer/string_literal.h

@@ -54,5 +54,4 @@ class StringLiteralToken {
   bool multi_line;
   bool multi_line;
 };
 };
 
 
-
 }  // namespace Carbon
 }  // namespace Carbon

+ 51 - 51
lexer/string_literal_test.cpp

@@ -84,9 +84,9 @@ TEST_F(StringLiteralTest, StringLiteralBounds) {
       R"(")",
       R"(")",
       R"("""
       R"("""
       "")",
       "")",
-      R"("\)",
+      R"("\)",  //
       R"("\")",
       R"("\")",
-      R"("\\)",
+      R"("\\)",  //
       R"("\\\")",
       R"("\\\")",
       R"("""
       R"("""
       )",
       )",
@@ -184,18 +184,18 @@ TEST_F(StringLiteralTest, StringLiteralContents) {
 
 
 TEST_F(StringLiteralTest, StringLiteralBadIndent) {
 TEST_F(StringLiteralTest, StringLiteralBadIndent) {
   std::pair<llvm::StringLiteral, llvm::StringLiteral> testcases[] = {
   std::pair<llvm::StringLiteral, llvm::StringLiteral> testcases[] = {
-    // Indent doesn't match the last line.
-    {"\"\"\"\n \tx\n  \"\"\"", "x\n"},
-    {"\"\"\"\n x\n  \"\"\"", "x\n"},
-    {"\"\"\"\n  x\n\t\"\"\"", "x\n"},
-    {"\"\"\"\n  ok\n bad\n  \"\"\"", "ok\nbad\n"},
-    {"\"\"\"\n bad\n  ok\n  \"\"\"", "bad\nok\n"},
-    {"\"\"\"\n  escaped,\\\n bad\n  \"\"\"", "escaped,bad\n"},
-
-    // Indent on last line is followed by text.
-    {"\"\"\"\n  x\n  x\"\"\"", "x\nx"},
-    {"\"\"\"\n   x\n  x\"\"\"", " x\nx"},
-    {"\"\"\"\n x\n  x\"\"\"", "x\nx"},
+      // Indent doesn't match the last line.
+      {"\"\"\"\n \tx\n  \"\"\"", "x\n"},
+      {"\"\"\"\n x\n  \"\"\"", "x\n"},
+      {"\"\"\"\n  x\n\t\"\"\"", "x\n"},
+      {"\"\"\"\n  ok\n bad\n  \"\"\"", "ok\nbad\n"},
+      {"\"\"\"\n bad\n  ok\n  \"\"\"", "bad\nok\n"},
+      {"\"\"\"\n  escaped,\\\n bad\n  \"\"\"", "escaped,bad\n"},
+
+      // Indent on last line is followed by text.
+      {"\"\"\"\n  x\n  x\"\"\"", "x\nx"},
+      {"\"\"\"\n   x\n  x\"\"\"", " x\nx"},
+      {"\"\"\"\n x\n  x\"\"\"", "x\nx"},
   };
   };
 
 
   for (auto [test, contents] : testcases) {
   for (auto [test, contents] : testcases) {
@@ -207,43 +207,43 @@ TEST_F(StringLiteralTest, StringLiteralBadIndent) {
 
 
 TEST_F(StringLiteralTest, StringLiteralBadEscapeSequence) {
 TEST_F(StringLiteralTest, StringLiteralBadEscapeSequence) {
   llvm::StringLiteral testcases[] = {
   llvm::StringLiteral testcases[] = {
-    R"("\a")",
-    R"("\b")",
-    R"("\e")",
-    R"("\f")",
-    R"("\v")",
-    R"("\?")",
-    R"("\1")",
-    R"("\9")",
-
-    // \0 can't be followed by a decimal digit.
-    R"("\01")",
-    R"("\09")",
-
-    // \x requires two (uppercase) hexadecimal digits.
-    R"("\x")",
-    R"("\x0")",
-    R"("\x0G")",
-    R"("\xab")",
-    R"("\x\n")",
-    R"("\x\"")",
-
-    // \u requires a braced list of one or more hexadecimal digits.
-    R"("\u")",
-    R"("\u?")",
-    R"("\u\"")",
-    R"("\u{")",
-    R"("\u{}")",
-    R"("\u{A")",
-    R"("\u{G}")",
-    R"("\u{0000012323127z}")",
-    R"("\u{-3}")",
-
-    // \u must specify a non-surrogate code point.
-    R"("\u{110000}")",
-    R"("\u{000000000000000000000000000000000110000}")",
-    R"("\u{D800}")",
-    R"("\u{DFFF}")",
+      R"("\a")",
+      R"("\b")",
+      R"("\e")",
+      R"("\f")",
+      R"("\v")",
+      R"("\?")",
+      R"("\1")",
+      R"("\9")",
+
+      // \0 can't be followed by a decimal digit.
+      R"("\01")",
+      R"("\09")",
+
+      // \x requires two (uppercase) hexadecimal digits.
+      R"("\x")",
+      R"("\x0")",
+      R"("\x0G")",
+      R"("\xab")",
+      R"("\x\n")",
+      R"("\x\"")",
+
+      // \u requires a braced list of one or more hexadecimal digits.
+      R"("\u")",
+      R"("\u?")",
+      R"("\u\"")",
+      R"("\u{")",
+      R"("\u{}")",
+      R"("\u{A")",
+      R"("\u{G}")",
+      R"("\u{0000012323127z}")",
+      R"("\u{-3}")",
+
+      // \u must specify a non-surrogate code point.
+      R"("\u{110000}")",
+      R"("\u{000000000000000000000000000000000110000}")",
+      R"("\u{D800}")",
+      R"("\u{DFFF}")",
   };
   };
 
 
   for (llvm::StringLiteral test : testcases) {
   for (llvm::StringLiteral test : testcases) {

+ 6 - 6
lexer/tokenized_buffer_test.cpp

@@ -721,14 +721,14 @@ TEST_F(LexerTest, InvalidStringLiterals) {
   llvm::StringLiteral invalid[] = {
   llvm::StringLiteral invalid[] = {
       R"(")",
       R"(")",
       R"("""
       R"("""
-      "")",
-      R"("\)",
-      R"("\")",
-      R"("\\)",
-      R"("\\\")",
+      "")",        //
+      R"("\)",     //
+      R"("\")",    //
+      R"("\\)",    //
+      R"("\\\")",  //
       R"(""")",
       R"(""")",
       R"("""
       R"("""
-      )",
+      )",  //
       R"("""\)",
       R"("""\)",
       R"(#"""
       R"(#"""
       """)",
       """)",