Address code review: use < 2 condition, fix docstring, assert first handle = 2
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/6973699c-a979-4d97-8213-1a4a501044a1 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
parent
afa63ccec7
commit
b8cbb7f68d
2 changed files with 5 additions and 2 deletions
|
|
@ -693,7 +693,7 @@ drop_alloc_dir_handle(Window *w, const char *path, char **entries, size_t num_en
|
|||
w->drop.next_dir_handle_id++;
|
||||
/* Handles 0 and 1 are reserved (0 = absent, 1 = symlink indicator), so
|
||||
* valid directory handles must be >= 2. */
|
||||
if (w->drop.next_dir_handle_id <= 1) w->drop.next_dir_handle_id = 2;
|
||||
if (w->drop.next_dir_handle_id < 2) w->drop.next_dir_handle_id = 2;
|
||||
DirHandle *h = &w->drop.dir_handles[w->drop.num_dir_handles++];
|
||||
zero_at_ptr(h);
|
||||
h->id = w->drop.next_dir_handle_id;
|
||||
|
|
|
|||
|
|
@ -753,7 +753,7 @@ def test_uri_non_regular_file_returns_einval(self) -> None:
|
|||
self.ae(events[0]['payload'].strip(), b'EINVAL')
|
||||
|
||||
def test_uri_directory_transfer_tree(self) -> None:
|
||||
"""Full directory tree (≥ 3 levels deep) transfer: listing, sub-dirs, file integrity.
|
||||
"""Full directory tree (>= 3 levels deep) transfer: listing, sub-dirs, file integrity.
|
||||
|
||||
Also verifies that every response from the terminal unambiguously
|
||||
identifies the filesystem object it refers to. For sub-directory
|
||||
|
|
@ -2014,6 +2014,9 @@ def test_X_key_is_handle_in_dir_listing_response(self) -> None:
|
|||
self.ae(ev['meta'].get('y'), '1')
|
||||
handle = dir_handle(ev)
|
||||
self.assertGreater(handle, 1, 'X= must be a directory handle (> 1)')
|
||||
# In a fresh window the handle counter starts at 1, so the
|
||||
# first allocated handle must be exactly 2.
|
||||
self.ae(handle, 2, 'first allocated directory handle must be 2')
|
||||
self.assertIsNone(ev['meta'].get('Y'),
|
||||
'Y= must not be present in top-level dir response')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue