diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-function-size.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/readability-function-size.cpp | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-function-size.cpp b/clang-tools-extra/test/clang-tidy/readability-function-size.cpp index 526e272de7f..53a3928157f 100644 --- a/clang-tools-extra/test/clang-tidy/readability-function-size.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-function-size.cpp @@ -1,58 +1,55 @@ -// RUN: rm -rf %t -// RUN: mkdir -p %t -// RUN: sed 's#// *[A-Z-][A-Z-]*:.*#//#' %s > %t/t.cpp -// RUN: echo '{ Checks: "-*,readability-function-size", CheckOptions: [{key: readability-function-size.LineThreshold, value: 0}, {key: readability-function-size.StatementThreshold, value: 0}, {key: readability-function-size.BranchThreshold, value: 0}]}' > %t/.clang-tidy -// RUN: clang-tidy %t/t.cpp -- -std=c++11 2>&1 | FileCheck %s -implicit-check-not='{{warning:|error:|note:}}' +// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-function-size %t -config='{CheckOptions: [{key: readability-function-size.LineThreshold, value: 0}, {key: readability-function-size.StatementThreshold, value: 0}, {key: readability-function-size.BranchThreshold, value: 0}]}' -- -std=c++11 +// REQUIRES: shell void foo1() { } void foo2() {;} -// CHECK: warning: function 'foo2' exceeds recommended size/complexity thresholds -// CHECK: note: 1 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo2' exceeds recommended size/complexity thresholds [readability-function-size] +// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 1 statements (threshold 0) void foo3() { ; } -// CHECK: warning: function 'foo3' exceeds recommended size/complexity thresholds -// CHECK: note: 3 lines including whitespace and comments (threshold 0) -// CHECK: note: 1 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'foo3' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 1 statements (threshold 0) void foo4(int i) { if (i) {} else; {} } -// CHECK: warning: function 'foo4' exceeds recommended size/complexity thresholds -// CHECK: note: 1 lines including whitespace and comments (threshold 0) -// CHECK: note: 3 statements (threshold 0) -// CHECK: note: 1 branches (threshold 0) +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foo4' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-3]]:6: note: 1 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 3 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 branches (threshold 0) void foo5(int i) {for(;i;)while(i) do;while(i); } -// CHECK: warning: function 'foo5' exceeds recommended size/complexity thresholds -// CHECK: note: 2 lines including whitespace and comments (threshold 0) -// CHECK: note: 7 statements (threshold 0) -// CHECK: note: 3 branches (threshold 0) +// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'foo5' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 7 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 3 branches (threshold 0) template <typename T> T foo6(T i) {return i; } int x = foo6(0); -// CHECK: warning: function 'foo6' exceeds recommended size/complexity thresholds -// CHECK: note: 1 lines including whitespace and comments (threshold 0) -// CHECK: note: 1 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-3]]:25: warning: function 'foo6' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-4]]:25: note: 1 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-5]]:25: note: 1 statements (threshold 0) void bar1() { [](){;;;;;;;;;;;if(1){}}(); } -// CHECK: warning: function 'bar1' exceeds recommended size/complexity thresholds -// CHECK: note: 3 lines including whitespace and comments (threshold 0) -// CHECK: note: 14 statements (threshold 0) -// CHECK: note: 1 branches (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'bar1' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0) +// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 14 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 1 branches (threshold 0) void bar2() { class A { void barx() {;;} }; } -// CHECK: warning: function 'bar2' exceeds recommended size/complexity thresholds -// CHECK: note: 3 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar2' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 3 statements (threshold 0) // -// CHECK: warning: function 'barx' exceeds recommended size/complexity thresholds -// CHECK: note: 2 statements (threshold 0) +// CHECK-MESSAGES: :[[@LINE-4]]:30: warning: function 'barx' exceeds recommended size/complexity +// CHECK-MESSAGES: :[[@LINE-5]]:30: note: 2 statements (threshold 0) |