def test_failure_with_case_insensitive(self) -> None: files = { 'main.cpp': textwrap.dedent("""\ #include "INCLUDED.HPP" """).encode(), 'included.hpp': textwrap.dedent("""\ int main() {} """).encode(), } with tests.utils.load_files(files={}) as tempdir: with tests.utils.chdir(tempdir): self.assertRaises(Exception, lambda: cplusplus.CPlusPlusLanguage().list_dependencies(tempdir / 'main.cpp', basedir=tempdir))
def test_success(self) -> None: files = { 'main.cpp': textwrap.dedent("""\ #include "included.hpp" """).encode(), 'included.hpp': textwrap.dedent("""\ int main() {} """).encode(), } with tests.utils.load_files(files) as tempdir: with tests.utils.chdir(tempdir): expected = sorted([tempdir / 'main.cpp', tempdir / 'included.hpp']) actual = sorted(cplusplus.CPlusPlusLanguage().list_dependencies(tempdir / 'main.cpp', basedir=tempdir)) self.assertEqual(actual, expected)