Author: alexfh Date: Wed Sep 11 13:10:30 2013 New Revision: 190537 URL: http://llvm.org/viewvc/llvm-project?rev=190537&view=rev Log: Test for correct usage of columnWidth in clang fixit hints.
Summary: 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). Reviewers: jordan_rose Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1607 Added: cfe/trunk/test/FixIt/fixit-unicode-with-utf8-output.c Modified: cfe/trunk/test/FixIt/fixit-unicode.c Added: cfe/trunk/test/FixIt/fixit-unicode-with-utf8-output.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-unicode-with-utf8-output.c?rev=190537&view=auto ============================================================================== --- cfe/trunk/test/FixIt/fixit-unicode-with-utf8-output.c (added) +++ cfe/trunk/test/FixIt/fixit-unicode-with-utf8-output.c Wed Sep 11 13:10:30 2013 @@ -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à¸}} Modified: cfe/trunk/test/FixIt/fixit-unicode.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-unicode.c?rev=190537&r1=190536&r2=190537&view=diff ============================================================================== --- cfe/trunk/test/FixIt/fixit-unicode.c (original) +++ cfe/trunk/test/FixIt/fixit-unicode.c Wed Sep 11 13:10:30 2013 @@ -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 @@ void test1() { // 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 @@ void test2() { // 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 @@ void test3() { // 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: {{^ \^}} _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
