Skip to content

Commit

Permalink
Add unit test for hidden paths exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
ionite34 committed Mar 10, 2023
1 parent efc899d commit 9b31db9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_nsjail.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,25 @@ def test_write_exceed_space(self):
self.assertIn("No space left on device", result.stdout)
self.assertEqual(result.stderr, None)

def test_write_hidden_exclude(self):
"""Hidden paths should be excluded from output."""
code = dedent(
"""
from pathlib import Path
Path("normal").mkdir()
Path("normal/a.txt").write_text("a")
Path("normal/.hidden.txt").write_text("a")
Path(".hidden").mkdir()
Path(".hidden/b.txt").write_text("b")
"""
).strip()

result = self.eval_file(code)
self.assertEqual(result.returncode, 0)
self.assertEqual(len(result.files), 1)
self.assertEqual(result.files[0].content, b"a")

def test_forkbomb_resource_unavailable(self):
code = dedent(
"""
Expand Down

0 comments on commit 9b31db9

Please sign in to comment.