From b7fb5e6f4b5a0ce5bd8df5ba38b64db3fd10bdda Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 25 Mar 2013 09:14:25 +0000 Subject: Re-add clang-format tests to clang/test. Also now use -strict-whitespace as the tests are confusing otherwise. llvm-svn: 177853 --- clang/test/Format/basic.cpp | 6 ++++++ clang/test/Format/diagnostic.cpp | 4 ++++ clang/test/Format/ranges.cpp | 11 +++++++++++ 3 files changed, 21 insertions(+) create mode 100644 clang/test/Format/basic.cpp create mode 100644 clang/test/Format/diagnostic.cpp create mode 100644 clang/test/Format/ranges.cpp (limited to 'clang/test/Format') diff --git a/clang/test/Format/basic.cpp b/clang/test/Format/basic.cpp new file mode 100644 index 00000000000..375bbd2ec71 --- /dev/null +++ b/clang/test/Format/basic.cpp @@ -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 ; diff --git a/clang/test/Format/diagnostic.cpp b/clang/test/Format/diagnostic.cpp new file mode 100644 index 00000000000..2e930ee5b79 --- /dev/null +++ b/clang/test/Format/diagnostic.cpp @@ -0,0 +1,4 @@ +// RUN: clang-format 2>&1 >/dev/null %s |FileCheck %s + +} +// CHECK: diagnostic.cpp:[[@LINE-1]]:1: error: unexpected '}' diff --git a/clang/test/Format/ranges.cpp b/clang/test/Format/ranges.cpp new file mode 100644 index 00000000000..0244fc195ca --- /dev/null +++ b/clang/test/Format/ranges.cpp @@ -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; -- cgit v1.2.3