@@ -60,7 +60,9 @@ class TestUnusedPrivateFunction : public TestFixture
6060
6161 // #2407 - FP when called from operator()
6262 TEST_CASE (fp_operator);
63- TEST_CASE (testDoesNotIdentifyCallback); // #2480
63+ TEST_CASE (testDoesNotIdentifyMethodAsFirstFunctionArgument); // #2480
64+ TEST_CASE (testDoesNotIdentifyMethodAsMiddleFunctionArgument);
65+ TEST_CASE (testDoesNotIdentifyMethodAsLastFunctionArgument);
6466 }
6567
6668
@@ -449,7 +451,7 @@ class TestUnusedPrivateFunction : public TestFixture
449451 ASSERT_EQUALS (" " , errout.str ());
450452 }
451453
452- void testDoesNotIdentifyCallback ()
454+ void testDoesNotIdentifyMethodAsFirstFunctionArgument ()
453455 {
454456 check (" #include <iostream>"
455457 " void callback(void (*func)(int), int arg)"
@@ -474,8 +476,66 @@ class TestUnusedPrivateFunction : public TestFixture
474476 " {"
475477 " MountOperation aExample(10);"
476478 " }"
477- );
478- TODO_ASSERT_EQUALS (" " , errout.str ());
479+ );
480+ ASSERT_EQUALS (" " , errout.str ());
481+ }
482+
483+ void testDoesNotIdentifyMethodAsMiddleFunctionArgument ()
484+ {
485+ check (" #include <iostream>"
486+ " void callback(char, void (*func)(int), int arg)"
487+ " {"
488+ " (*func)(arg);"
489+ " }"
490+ " class MountOperation"
491+ " {"
492+ " static void Completed(int i);"
493+ " public:"
494+ " MountOperation(int i);"
495+ " };"
496+ " void MountOperation::Completed(int i)"
497+ " {"
498+ " std::cerr << i << std::endl;"
499+ " }"
500+ " MountOperation::MountOperation(int i)"
501+ " {"
502+ " callback('a', MountOperation::Completed, i);"
503+ " }"
504+ " int main(void)"
505+ " {"
506+ " MountOperation aExample(10);"
507+ " }"
508+ );
509+ ASSERT_EQUALS (" " , errout.str ());
510+ }
511+
512+ void testDoesNotIdentifyMethodAsLastFunctionArgument ()
513+ {
514+ check (" #include <iostream>"
515+ " void callback(int arg, void (*func)(int))"
516+ " {"
517+ " (*func)(arg);"
518+ " }"
519+ " class MountOperation"
520+ " {"
521+ " static void Completed(int i);"
522+ " public:"
523+ " MountOperation(int i);"
524+ " };"
525+ " void MountOperation::Completed(int i)"
526+ " {"
527+ " std::cerr << i << std::endl;"
528+ " }"
529+ " MountOperation::MountOperation(int i)"
530+ " {"
531+ " callback(i, MountOperation::Completed);"
532+ " }"
533+ " int main(void)"
534+ " {"
535+ " MountOperation aExample(10);"
536+ " }"
537+ );
538+ ASSERT_EQUALS (" " , errout.str ());
479539 }
480540};
481541
0 commit comments