Skip to content

Commit 67ba040

Browse files
committed
Add test of find_duplicates for symlinks
Signed-off-by: John Pennycook <[email protected]>
1 parent b7ec900 commit 67ba040

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/duplicates/test_duplicates.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ def test_find_duplicates(self):
134134

135135
tmp.cleanup()
136136

137+
def test_find_duplicates_symlinks(self):
138+
"""Check that we ignore symlinks when identifying duplicates."""
139+
tmp = tempfile.TemporaryDirectory()
140+
path = Path(tmp.name)
141+
with open(path / "foo.cpp", mode="w") as f:
142+
f.write("void foo();")
143+
os.symlink(path / "foo.cpp", path / "bar.cpp")
144+
codebase = CodeBase(path)
145+
146+
duplicates = find_duplicates(codebase)
147+
self.assertEqual(duplicates, [])
148+
149+
tmp.cleanup()
150+
137151

138152
if __name__ == "__main__":
139153
unittest.main()

0 commit comments

Comments
 (0)