Hi jordan_rose,

This test only works on systems capable of outputting UTF-8 encoded
text on the standard output (tested on linux and OS X, should XFAIL on windows,
if I haven't messed up the XFAIL line).

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

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

Index: test/FixIt/fixit-unicode-output.c
===================================================================
--- /dev/null
+++ test/FixIt/fixit-unicode-output.c
@@ -0,0 +1,40 @@
+// This test is a version of 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 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | 
FileCheck -check-prefix=CHECK-MACHINE %s
+
+int printf(const char *, ...);
+void test2() {
+  printf("∆: %d", 1L);
+// CHECK: warning: format specifies type 'int' but the argument has type 'long'
+// CHECK: {{^  printf\("∆: %d", 1L\);}}
+// CHECK: {{^             ~~   \^~}}
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-4]]:16-[[@LINE-4]]:18}:"%ld"
+}
+
+void test3() {
+  int กssss = 42;
+  int a = กsss; // expected-error{{use of undeclared identifier 'กsss'; did 
you mean 'กssss'?}}
+// CHECK: {{^          \^}}
+// CHECK: {{^          กssss}}
+// CHECK-MACHINE: 
fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:17}:"\340\270\201ssss"
+
+  int ssกss = 42;
+  int b = ssกs; // expected-error{{use of undeclared identifier 'ssกs'; did 
you mean 'ssกss'?}}
+// CHECK: {{^          \^}}
+// 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: {{^                        \^~~~~~~~}}
+// CHECK: {{^                        s一二三}}
+// CHECK-MACHINE: 
fix-it:"{{.*}}":{[[@LINE-3]]:32-[[@LINE-3]]: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: {{^          \^}}
+// CHECK: {{^          sssssssssก}}
+// CHECK-MACHINE: 
fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:20}:"sssssssss\340\270\201"
+}
Index: test/FixIt/fixit-unicode-output.c
===================================================================
--- /dev/null
+++ test/FixIt/fixit-unicode-output.c
@@ -0,0 +1,40 @@
+// This test is a version of 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 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -check-prefix=CHECK-MACHINE %s
+
+int printf(const char *, ...);
+void test2() {
+  printf("∆: %d", 1L);
+// CHECK: warning: format specifies type 'int' but the argument has type 'long'
+// CHECK: {{^  printf\("∆: %d", 1L\);}}
+// CHECK: {{^             ~~   \^~}}
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-4]]:16-[[@LINE-4]]:18}:"%ld"
+}
+
+void test3() {
+  int กssss = 42;
+  int a = กsss; // expected-error{{use of undeclared identifier 'กsss'; did you mean 'กssss'?}}
+// CHECK: {{^          \^}}
+// CHECK: {{^          กssss}}
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:17}:"\340\270\201ssss"
+
+  int ssกss = 42;
+  int b = ssกs; // expected-error{{use of undeclared identifier 'ssกs'; did you mean 'ssกss'?}}
+// CHECK: {{^          \^}}
+// 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: {{^                        \^~~~~~~~}}
+// CHECK: {{^                        s一二三}}
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-3]]:32-[[@LINE-3]]: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: {{^          \^}}
+// CHECK: {{^          sssssssssก}}
+// CHECK-MACHINE: fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:20}:"sssssssss\340\270\201"
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to