| 24 | |
| 25 | class IncludeLinks(unittest.TestCase): |
| 26 | def setUp(self): |
| 27 | self.temp = tempfile.TemporaryDirectory(prefix="htmlify-test-") |
| 28 | self.addCleanup(self.temp.cleanup) |
| 29 | self.root = Path(self.temp.name) |
| 30 | self.source = self.root / "source" |
| 31 | self.main = self.put( |
| 32 | "examples/main.cpp", |
| 33 | '#include "pkg/header.h"\n#include "local.h"\n' |
| 34 | '#include "missing.h"\n#include "duplicate.h"\n', |
| 35 | ) |
| 36 | self.put("pkg/header.h", "// library header\n") |
| 37 | self.put("examples/local.h", "// local header takes precedence\n") |
| 38 | self.put("inc/local.h", "// include-directory header\n") |
| 39 | self.put("inc/duplicate.h", "// first include directory\n") |
| 40 | self.put("other/duplicate.h", "// second include directory\n") |
| 41 | self.put("other/missing.h", "// must not match by basename\n") |
| 42 | |
| 43 | def put(self, name, contents): |
| 44 | path = self.source / name |