@@ -4575,6 +4575,47 @@ def run_and_assert_cppcheck(stdout_exp):
45754575 # - internalError
45764576
45774577
4578+ def test_analyzerinfo_include_order (tmp_path ): # #15132
4579+ with open (tmp_path / 'z.h' , 'wt' ) as f :
4580+ f .write ('int z;\n ' )
4581+ with open (tmp_path / 'a.h' , 'wt' ) as f :
4582+ f .write ('int a;\n ' )
4583+ test_file = tmp_path / 'test.c'
4584+ with open (test_file , 'wt' ) as f :
4585+ f .write (
4586+ """#include "z.h"
4587+ #include "a.h"
4588+ int f(void) { return a + z; }
4589+ """ )
4590+
4591+ build_dir = tmp_path / 'b1'
4592+ os .makedirs (build_dir )
4593+
4594+ args = [
4595+ '-q' ,
4596+ '--debug-analyzerinfo' ,
4597+ '--cppcheck-build-dir={}' .format (build_dir ),
4598+ str (test_file )
4599+ ]
4600+
4601+ test_file_s = str (test_file ).replace ('\\ ' , '/' )
4602+ test_a1_file_s = str (build_dir / 'test.a1' ).replace ('\\ ' , '/' )
4603+
4604+ exitcode , stdout , stderr = cppcheck (args )
4605+ assert exitcode == 0 , stdout
4606+ assert stdout .splitlines () == [
4607+ "no cached result '{}' for '{}' found" .format (test_a1_file_s , test_file_s )
4608+ ]
4609+ assert stderr .splitlines () == []
4610+
4611+ exitcode , stdout , stderr = cppcheck (args )
4612+ assert exitcode == 0 , stdout
4613+ assert stdout .splitlines () == [
4614+ "skipping analysis - loaded 0 cached finding(s) from '{}' for '{}'" .format (test_a1_file_s , test_file_s )
4615+ ]
4616+ assert stderr .splitlines () == []
4617+
4618+
45784619def test_ctu_function_call_path_slash (tmp_path ): # #14591
45794620 test_file = tmp_path / 'test.cpp'
45804621 with open (test_file , "w" ) as f :
0 commit comments