core/tools: distinguish missing files from non-files on read

This commit is contained in:
2026-08-11 15:37:56 +08:00
parent 25e6ec3d44
commit e4ed89b391
3 changed files with 25 additions and 10 deletions
+6
View File
@@ -97,6 +97,12 @@ def test_read_offset_limit(workspace: object) -> None:
assert call_sync(read_file, "lines.txt", offset=1, limit=2) == "L2-3\nb\nc\n"
def test_read_file_missing_and_directory(workspace: Path) -> None:
(workspace / "sub").mkdir()
assert call_sync(read_file, "nope.txt") == "error: file not found: nope.txt"
assert call_sync(read_file, "sub") == "error: not a file: sub"
def test_read_with_lineno(workspace: object) -> None:
del workspace
_ = call_sync(write_file, "num.txt", "a\nb\nc\n")