[clang-tools-extra] r343797 - [clang-tidy] fix failing unit tests

Jonas Toth via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 09:39:41 PDT 2018


Author: jonastoth
Date: Thu Oct  4 09:39:41 2018
New Revision: 343797

URL: http://llvm.org/viewvc/llvm-project?rev=343797&view=rev
Log:
[clang-tidy] fix failing unit tests

The removal from the FIX-IT notes through the check-clang-tidy
script was done incorrect. I did not detect beforehand but adjusted
the script and tests accordingly

Modified:
    clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-gmock.cpp
    clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-strict.cpp
    clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment.cpp
    clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
    clang-tools-extra/trunk/test/clang-tidy/fuchsia-default-arguments.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-gmock.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-gmock.cpp?rev=343797&r1=343796&r2=343797&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-gmock.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-gmock.cpp Thu Oct  4 09:39:41 2018
@@ -84,20 +84,18 @@ void test_gmock_expectations() {
   MockDerived m;
   EXPECT_CALL(m, Method(/*param_one=*/1, /*param_tw=*/2));
 // CHECK-NOTES: [[@LINE-1]]:42: warning: argument name 'param_tw' in comment does not match parameter name 'param_two'
-// CHECK-NOTES: [[@LINE-2]]:42: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-19]]:42: note: 'param_two' declared here
-// CHECK-NOTES: [[@LINE-15]]:3: note: actual callee ('gmock_Method') is declared here
-// CHECK-NOTES: [[@LINE-33]]:30: note: expanded from macro 'MOCK_METHOD2'
-// CHECK-NOTES: [[@LINE-36]]:7: note: expanded from macro 'GMOCK_METHOD2_'
+// CHECK-NOTES: [[@LINE-18]]:42: note: 'param_two' declared here
+// CHECK-NOTES: [[@LINE-14]]:3: note: actual callee ('gmock_Method') is declared here
+// CHECK-NOTES: [[@LINE-32]]:30: note: expanded from macro 'MOCK_METHOD2'
+// CHECK-NOTES: [[@LINE-35]]:7: note: expanded from macro 'GMOCK_METHOD2_'
 // CHECK-NOTES: note: expanded from here
 // CHECK-FIXES:   EXPECT_CALL(m, Method(/*param_one=*/1, /*param_two=*/2));
   EXPECT_CALL(m, Method2(/*p_on=*/3, /*p_two=*/4));
 // CHECK-NOTES: [[@LINE-1]]:26: warning: argument name 'p_on' in comment does not match parameter name 'p_one'
-// CHECK-NOTES: [[@LINE-2]]:26: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-27]]:28: note: 'p_one' declared here
-// CHECK-NOTES: [[@LINE-23]]:3: note: actual callee ('gmock_Method2') is declared here
-// CHECK-NOTES: [[@LINE-41]]:36: note: expanded from macro 'MOCK_CONST_METHOD2'
-// CHECK-NOTES: [[@LINE-45]]:7: note: expanded from macro 'GMOCK_METHOD2_'
+// CHECK-NOTES: [[@LINE-25]]:28: note: 'p_one' declared here
+// CHECK-NOTES: [[@LINE-21]]:3: note: actual callee ('gmock_Method2') is declared here
+// CHECK-NOTES: [[@LINE-39]]:36: note: expanded from macro 'MOCK_CONST_METHOD2'
+// CHECK-NOTES: [[@LINE-43]]:7: note: expanded from macro 'GMOCK_METHOD2_'
 // CHECK-NOTES: note: expanded from here
 // CHECK-FIXES:   EXPECT_CALL(m, Method2(/*p_one=*/3, /*p_two=*/4));
 
@@ -105,18 +103,16 @@ void test_gmock_expectations() {
   #define PARAM2 22
   EXPECT_CALL(m, Method2(/*p_on1=*/PARAM1, /*p_tw2=*/PARAM2));
 // CHECK-NOTES: [[@LINE-1]]:26: warning: argument name 'p_on1' in comment does not match parameter name 'p_one'
-// CHECK-NOTES: [[@LINE-2]]:26: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-39]]:28: note: 'p_one' declared here
-// CHECK-NOTES: [[@LINE-35]]:3: note: actual callee ('gmock_Method2') is declared here
-// CHECK-NOTES: [[@LINE-53]]:36: note: expanded from macro 'MOCK_CONST_METHOD2'
-// CHECK-NOTES: [[@LINE-57]]:7: note: expanded from macro 'GMOCK_METHOD2_'
+// CHECK-NOTES: [[@LINE-36]]:28: note: 'p_one' declared here
+// CHECK-NOTES: [[@LINE-32]]:3: note: actual callee ('gmock_Method2') is declared here
+// CHECK-NOTES: [[@LINE-50]]:36: note: expanded from macro 'MOCK_CONST_METHOD2'
+// CHECK-NOTES: [[@LINE-54]]:7: note: expanded from macro 'GMOCK_METHOD2_'
 // CHECK-NOTES: note: expanded from here
-// CHECK-NOTES: [[@LINE-8]]:44: warning: argument name 'p_tw2' in comment does not match parameter name 'p_two'
-// CHECK-NOTES: [[@LINE-9]]:44: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-46]]:39: note: 'p_two' declared here
-// CHECK-NOTES: [[@LINE-42]]:3: note: actual callee ('gmock_Method2') is declared here
-// CHECK-NOTES: [[@LINE-60]]:36: note: expanded from macro 'MOCK_CONST_METHOD2'
-// CHECK-NOTES: [[@LINE-64]]:7: note: expanded from macro 'GMOCK_METHOD2_'
+// CHECK-NOTES: [[@LINE-7]]:44: warning: argument name 'p_tw2' in comment does not match parameter name 'p_two'
+// CHECK-NOTES: [[@LINE-42]]:39: note: 'p_two' declared here
+// CHECK-NOTES: [[@LINE-38]]:3: note: actual callee ('gmock_Method2') is declared here
+// CHECK-NOTES: [[@LINE-56]]:36: note: expanded from macro 'MOCK_CONST_METHOD2'
+// CHECK-NOTES: [[@LINE-60]]:7: note: expanded from macro 'GMOCK_METHOD2_'
 // CHECK-NOTES: note: expanded from here
 // CHECK-FIXES:   EXPECT_CALL(m, Method2(/*p_one=*/PARAM1, /*p_two=*/PARAM2));
 
@@ -128,8 +124,7 @@ void test_gmock_direct_calls() {
   MockDerived m;
   m.Method(/*param_one=*/1, /*param_tw=*/2);
 // CHECK-NOTES: [[@LINE-1]]:29: warning: argument name 'param_tw' in comment does not match parameter name 'param_two'
-// CHECK-NOTES: [[@LINE-2]]:29: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-63]]:42: note: 'param_two' declared here
-// CHECK-NOTES: [[@LINE-59]]:16: note: actual callee ('Method') is declared here
+// CHECK-NOTES: [[@LINE-58]]:42: note: 'param_two' declared here
+// CHECK-NOTES: [[@LINE-54]]:16: note: actual callee ('Method') is declared here
 // CHECK-FIXES:   m.Method(/*param_one=*/1, /*param_two=*/2);
 }

Modified: clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-strict.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-strict.cpp?rev=343797&r1=343796&r2=343797&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-strict.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment-strict.cpp Thu Oct  4 09:39:41 2018
@@ -6,23 +6,19 @@ void g(int x_);
 void ignores_underscores() {
   f(/*With_Underscores=*/0);
 // CHECK-NOTES: [[@LINE-1]]:5: warning: argument name 'With_Underscores' in comment does not match parameter name '_with_underscores_'
-// CHECK-NOTES: [[@LINE-2]]:5: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-6]]:12: note: '_with_underscores_' declared here
+// CHECK-NOTES: [[@LINE-5]]:12: note: '_with_underscores_' declared here
 // CHECK-FIXES: f(/*_with_underscores_=*/0);
 
   f(/*with_underscores=*/1);
 // CHECK-NOTES: [[@LINE-1]]:5: warning: argument name 'with_underscores' in comment does not match parameter name '_with_underscores_'
-// CHECK-NOTES: [[@LINE-2]]:5: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-12]]:12: note: '_with_underscores_' declared here
+// CHECK-NOTES: [[@LINE-10]]:12: note: '_with_underscores_' declared here
 // CHECK-FIXES: f(/*_with_underscores_=*/1);
   f(/*_With_Underscores_=*/2);
 // CHECK-NOTES: [[@LINE-1]]:5: warning: argument name '_With_Underscores_' in comment does not match parameter name '_with_underscores_'
-// CHECK-NOTES: [[@LINE-2]]:5: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-17]]:12: note: '_with_underscores_' declared here
+// CHECK-NOTES: [[@LINE-14]]:12: note: '_with_underscores_' declared here
 // CHECK-FIXES: f(/*_with_underscores_=*/2);
   g(/*X=*/3);
 // CHECK-NOTES: [[@LINE-1]]:5: warning: argument name 'X' in comment does not match parameter name 'x_'
-// CHECK-NOTES: [[@LINE-2]]:5: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-21]]:12: note: 'x_' declared here
+// CHECK-NOTES: [[@LINE-17]]:12: note: 'x_' declared here
 // CHECK-FIXES: g(/*x_=*/3);
 }

Modified: clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment.cpp?rev=343797&r1=343796&r2=343797&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/bugprone-argument-comment.cpp Thu Oct  4 09:39:41 2018
@@ -47,8 +47,7 @@ void templates() {
   variadic(/*xxx=*/0, /*yyy=*/1);
   variadic2(/*zzU=*/0, /*xxx=*/1, /*yyy=*/2);
   // CHECK-NOTES: [[@LINE-1]]:13: warning: argument name 'zzU' in comment does not match parameter name 'zzz'
-  // CHECK-NOTES: [[@LINE-2]]:13: note: FIX-IT applied suggested code changes
-  // CHECK-NOTES: :[[@LINE-7]]:20: note: 'zzz' declared here
+  // CHECK-NOTES: :[[@LINE-6]]:20: note: 'zzz' declared here
   // CHECK-FIXES: variadic2(/*zzz=*/0, /*xxx=*/1, /*yyy=*/2);
 }
 
@@ -76,16 +75,14 @@ namespace OtherEditDistanceAboveThreshol
 void f5(int xxx, int yyy);
 void g() { f5(/*Zxx=*/0, 0); }
 // CHECK-NOTES: [[@LINE-1]]:15: warning: argument name 'Zxx' in comment does not match parameter name 'xxx'
-// CHECK-NOTES: [[@LINE-2]]:15: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-4]]:13: note: 'xxx' declared here
+// CHECK-NOTES: [[@LINE-3]]:13: note: 'xxx' declared here
 // CHECK-FIXES: void g() { f5(/*xxx=*/0, 0); }
 struct C2 {
   C2(int xxx, int yyy);
 };
 C2 c2(/*Zxx=*/0, 0);
 // CHECK-NOTES: [[@LINE-1]]:7: warning: argument name 'Zxx' in comment does not match parameter name 'xxx'
-// CHECK-NOTES: [[@LINE-2]]:7: note: FIX-IT applied suggested code changes
-// CHECK-NOTES: [[@LINE-5]]:10: note: 'xxx' declared here
+// CHECK-NOTES: [[@LINE-4]]:10: note: 'xxx' declared here
 // CHECK-FIXES: C2 c2(/*xxx=*/0, 0);
 }
 

Modified: clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py?rev=343797&r1=343796&r2=343797&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py (original)
+++ clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py Thu Oct  4 09:39:41 2018
@@ -165,7 +165,7 @@ def main():
   if has_check_notes:
     notes_file = temp_file_name + '.notes'
     filtered_output = [line for line in clang_tidy_output.splitlines()
-                       if not "note: FIX-IT applied suggested changes" in line]
+                       if not "note: FIX-IT applied" in line]
     write_file(notes_file, '\n'.join(filtered_output))
     try:
       subprocess.check_output(

Modified: clang-tools-extra/trunk/test/clang-tidy/fuchsia-default-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/fuchsia-default-arguments.cpp?rev=343797&r1=343796&r2=343797&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/fuchsia-default-arguments.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/fuchsia-default-arguments.cpp Thu Oct  4 09:39:41 2018
@@ -7,7 +7,7 @@ int foo(int value = 5) { return value; }
 int f() {
   foo();
   // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
-  // CHECK-NOTES: [[@LINE-8]]:9: note: default parameter was declared here
+  // CHECK-NOTES: [[@LINE-7]]:9: note: default parameter was declared here
 }
 
 int bar(int value) { return value; }
@@ -71,10 +71,10 @@ int main() {
   S s;
   s.x();
   // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
-  // CHECK-NOTES: [[@LINE-9]]:11: note: default parameter was declared here
+  // CHECK-NOTES: [[@LINE-8]]:11: note: default parameter was declared here
   // CHECK-NEXT: void S::x(int i = 12) {}
   x();
   // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
-  // CHECK-NOTES: [[@LINE-19]]:8: note: default parameter was declared here
+  // CHECK-NOTES: [[@LINE-18]]:8: note: default parameter was declared here
   // CHECK-NEXT: void x(int i = 12);
 }




More information about the cfe-commits mailing list