Skip to content

Commit 9b31db9

Browse files
committed
Add unit test for hidden paths exclusion
1 parent efc899d commit 9b31db9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_nsjail.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,25 @@ def test_write_exceed_space(self):
170170
self.assertIn("No space left on device", result.stdout)
171171
self.assertEqual(result.stderr, None)
172172

173+
def test_write_hidden_exclude(self):
174+
"""Hidden paths should be excluded from output."""
175+
code = dedent(
176+
"""
177+
from pathlib import Path
178+
179+
Path("normal").mkdir()
180+
Path("normal/a.txt").write_text("a")
181+
Path("normal/.hidden.txt").write_text("a")
182+
Path(".hidden").mkdir()
183+
Path(".hidden/b.txt").write_text("b")
184+
"""
185+
).strip()
186+
187+
result = self.eval_file(code)
188+
self.assertEqual(result.returncode, 0)
189+
self.assertEqual(len(result.files), 1)
190+
self.assertEqual(result.files[0].content, b"a")
191+
173192
def test_forkbomb_resource_unavailable(self):
174193
code = dedent(
175194
"""

0 commit comments

Comments
 (0)