@@ -147,6 +147,40 @@ def test_slnx_no_xml_root(tmpdir):
147147 __test_project_error (tmpdir , "slnx" , content , expected )
148148
149149
150+ def test_sln_no_projects (tmpdir ):
151+ content = "\xEF \xBB \xBF \r \n " \
152+ '<?xml version="1.0" encoding="UTF-8"?>\r \n ' \
153+ "<Solution>\r \n " \
154+ " <Configurations>\r \n " \
155+ ' <Platform Name="x64" />\r \n ' \
156+ ' <Platform Name="x86" />\r \n ' \
157+ " </Configurations>\r \n " \
158+ "</Solution>\r \n "
159+
160+ expected = "no projects found in Visual Studio solution file"
161+
162+ __test_project_error (tmpdir , "slnx" , content , expected )
163+
164+
165+ def test_slnx_project_file_not_found (tmpdir ):
166+ content = "\xEF \xBB \xBF \r \n " \
167+ '<?xml version="1.0" encoding="UTF-8"?>\r \n ' \
168+ "<Solution>\r \n " \
169+ " <Configurations>\r \n " \
170+ ' <Platform Name="x64" />\r \n ' \
171+ ' <Platform Name="x86" />\r \n ' \
172+ " </Configurations>\r \n " \
173+ ' <Project Path="test.vcxproj" />\r \n ' \
174+ "</Solution>\r \n "
175+
176+ expected = "Visual Studio project file is not a valid XML - XML_ERROR_FILE_NOT_FOUND\n " \
177+ "cppcheck: error: failed to load '{}' from Visual Studio solution" .format (os .path .join (tmpdir , "test.vcxproj" ))
178+ if sys .platform == "win32" :
179+ expected = expected .replace ('\\ ' , '/' )
180+
181+ __test_project_error (tmpdir , "slnx" , content , expected )
182+
183+
150184def test_vcxproj_no_xml_root (tmpdir ):
151185 content = '<?xml version="1.0" encoding="utf-8"?>'
152186
0 commit comments