r177853 - Re-add clang-format tests to clang/test.

Daniel Jasper djasper at google.com
Mon Mar 25 02:14:25 PDT 2013


Author: djasper
Date: Mon Mar 25 04:14:25 2013
New Revision: 177853

URL: http://llvm.org/viewvc/llvm-project?rev=177853&view=rev
Log:
Re-add clang-format tests to clang/test.

Also now use -strict-whitespace as the tests are confusing otherwise.

Added:
    cfe/trunk/test/Format/
    cfe/trunk/test/Format/basic.cpp
    cfe/trunk/test/Format/diagnostic.cpp
    cfe/trunk/test/Format/ranges.cpp
Modified:
    cfe/trunk/test/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=177853&r1=177852&r2=177853&view=diff
==============================================================================
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Mon Mar 25 04:14:25 2013
@@ -29,7 +29,7 @@ endif ()
 set(CLANG_TEST_DEPS
   clang clang-headers
   c-index-test diagtool arcmt-test c-arcmt-test
-  clang-check
+  clang-check clang-format
   )
 set(CLANG_TEST_PARAMS
   clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg

Added: cfe/trunk/test/Format/basic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/basic.cpp?rev=177853&view=auto
==============================================================================
--- cfe/trunk/test/Format/basic.cpp (added)
+++ cfe/trunk/test/Format/basic.cpp Mon Mar 25 04:14:25 2013
@@ -0,0 +1,6 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-format -i %t.cpp
+// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+
+// CHECK: {{^int\ \*i;}}
+ int   *  i  ;

Added: cfe/trunk/test/Format/diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/diagnostic.cpp?rev=177853&view=auto
==============================================================================
--- cfe/trunk/test/Format/diagnostic.cpp (added)
+++ cfe/trunk/test/Format/diagnostic.cpp Mon Mar 25 04:14:25 2013
@@ -0,0 +1,4 @@
+// RUN: clang-format 2>&1 >/dev/null %s |FileCheck %s
+
+}
+// CHECK: diagnostic.cpp:[[@LINE-1]]:1: error: unexpected '}'

Added: cfe/trunk/test/Format/ranges.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/ranges.cpp?rev=177853&view=auto
==============================================================================
--- cfe/trunk/test/Format/ranges.cpp (added)
+++ cfe/trunk/test/Format/ranges.cpp Mon Mar 25 04:14:25 2013
@@ -0,0 +1,11 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-format -offset=2 -length=0 -offset=28 -length=0 -i %t.cpp
+// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// CHECK: {{^int\ \*i;$}}
+  int*i;
+
+// CHECK: {{^\ \ int\ \ \*\ \ i;$}}
+  int  *  i; 
+
+// CHECK: {{^\ \ int\ \*i;$}}
+  int   *   i;





More information about the cfe-commits mailing list