[PATCH] Test for correct usage of columnWidth in clang fixit hints.

Alexander Kornienko alexfh at google.com
Fri Sep 6 10:51:55 PDT 2013


  Separated checks from actual code.

  Please take another look.

Hi jordan_rose,

http://llvm-reviews.chandlerc.com/D1607

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1607?vs=4063&id=4110#toc

Files:
  test/FixIt/fixit-unicode-with-utf8-output.c
  test/FixIt/fixit-unicode.c

Index: test/FixIt/fixit-unicode-with-utf8-output.c
===================================================================
--- /dev/null
+++ test/FixIt/fixit-unicode-with-utf8-output.c
@@ -0,0 +1,25 @@
+// This test is an additional set of checks for the fixit-unicode.c test for
+// systems capable of outputting Unicode characters to the standard output in
+// the UTF-8 encoding.
+// XFAIL: mingw32,win32,win64
+// RUN: not %clang_cc1 -fsyntax-only %S/fixit-unicode.c 2>&1 | FileCheck -strict-whitespace %s
+
+// CHECK: warning: format specifies type 'int' but the argument has type 'long'
+// CHECK: {{^  printf\("∆: %d", 1L\);}}
+// CHECK: {{^             ~~   \^~}}
+
+// CHECK: error: use of undeclared identifier 'กsss'; did you mean 'กssss'?
+// CHECK: {{^          \^}}
+// CHECK: {{^          กssss}}
+
+// CHECK: error: use of undeclared identifier 'ssกs'; did you mean 'ssกss'?
+// CHECK: {{^          \^}}
+// CHECK: {{^          ssกss}}
+
+// CHECK: error: use of undeclared identifier 'ss一二三'; did you mean 's一二三'?
+// CHECK: {{^                        \^~~~~~~~}}
+// CHECK: {{^                        s一二三}}
+
+// CHECK: error: use of undeclared identifier 'sssssssss'; did you mean 'sssssssssก'?
+// CHECK: {{^          \^}}
+// CHECK: {{^          sssssssssก}}
Index: test/FixIt/fixit-unicode.c
===================================================================
--- test/FixIt/fixit-unicode.c
+++ test/FixIt/fixit-unicode.c
@@ -1,3 +1,7 @@
+// This file contains code and checks, that should work on any platform.
+// There's a set of additional checks for systems with proper support of UTF-8
+// on the standard output in fixit-unicode-with-utf8-output.c.
+
 // RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s
 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -check-prefix=CHECK-MACHINE %s
 
@@ -16,8 +20,8 @@
 // CHECK: {{^              \^}}
 // CHECK: {{^              ;}}
 
-// CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{[[@LINE-8]]:15-[[@LINE-8]]:18}:""
-// CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{[[@LINE-9]]:15-[[@LINE-9]]:15}:";"
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-8]]:15-[[@LINE-8]]:18}:""
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-9]]:15-[[@LINE-9]]:15}:";"
 }
 
 
@@ -32,7 +36,7 @@
 // because different systems will render the delta differently (either as a
 // character, or as <U+2206>.) The fixit should line up with the %d regardless.
 
-// CHECK-MACHINE: fix-it:"{{.*}}fixit-unicode.c":{[[@LINE-9]]:16-[[@LINE-9]]:18}:"%ld"
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-9]]:16-[[@LINE-9]]:18}:"%ld"
 }
 
 void test3() {
@@ -48,6 +52,11 @@
 // CHECK: {{^          ss.+ss}}
 // CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:17}:"ss\340\270\201ss"
 
+  int s一二三 = 42;
+  int b一二三四五六七 = ss一二三; // expected-error{{use of undeclared identifier 'ss一二三'; did you mean 's一二三'?}}
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-1]]:32-[[@LINE-1]]:43}:"s\344\270\200\344\272\214\344\270\211"
+
+
   int sssssssssก = 42;
   int c = sssssssss; // expected-error{{use of undeclared identifier 'sssssssss'; did you mean 'sssssssssก'?}}
 // CHECK: {{^          \^}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1607.2.patch
Type: text/x-patch
Size: 3260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130906/7ee8727e/attachment.bin>


More information about the cfe-commits mailing list