@@ -784,7 +784,7 @@ def test_addon_result(tmpdir):
784784
785785# TODO: test with -j2
786786# #11483
787- def test_unused_function_include (tmpdir ):
787+ def __test_unused_function_include (tmpdir , extra_args ):
788788 test_cpp_file = os .path .join (tmpdir , 'test.cpp' )
789789 with open (test_cpp_file , 'wt' ) as f :
790790 f .write ("""
@@ -802,12 +802,31 @@ class A {
802802 };
803803 """ )
804804
805- args = ['--enable=unusedFunction' , '--inline-suppr' , '--template=simple' , '-j1' , test_cpp_file ]
805+ args = [
806+ '--enable=unusedFunction' ,
807+ '--inline-suppr' ,
808+ '--template=simple' ,
809+ '-j1' ,
810+ test_cpp_file
811+ ]
812+
813+ args += extra_args
806814
807815 _ , _ , stderr = cppcheck (args )
808816 assert stderr == "{}:4:0: style: The function 'f' is never used. [unusedFunction]\n " .format (test_h_file )
809817
810818
819+ def test_unused_function_include (tmpdir ):
820+ __test_unused_function_include (tmpdir , [])
821+
822+
823+ # TODO: remove when we inject builddir
824+ def test_unused_function_include_builddir (tmpdir ):
825+ builddir = os .path .join (tmpdir , 'injected' )
826+ os .makedirs (builddir )
827+ __test_unused_function_include (tmpdir , ['--cppcheck-build-dir={}' .format (builddir )])
828+
829+
811830# TODO: test with all other types
812831def test_showtime_top5_file (tmpdir ):
813832 test_file = os .path .join (tmpdir , 'test.cpp' )
0 commit comments