diff options
author | Jon Huhn <nojnhuh@users.noreply.github.com> | 2023-04-17 11:50:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 18:50:05 +0200 |
commit | 6cc76011ca28ff61f1c2f8de6d895d4c6d0a1ad8 (patch) | |
tree | ebe99396340915a3243375d55a75d841113e1b8e /test/functional | |
parent | 9e5f9c25d9955f8c0ab7de874cf3a40fc077458b (diff) | |
download | rneovim-6cc76011ca28ff61f1c2f8de6d895d4c6d0a1ad8.tar.gz rneovim-6cc76011ca28ff61f1c2f8de6d895d4c6d0a1ad8.tar.bz2 rneovim-6cc76011ca28ff61f1c2f8de6d895d4c6d0a1ad8.zip |
fix(watchfiles): skip Created events when poll starts (#23139)
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/lua/watch_spec.lua | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua index bbcfd27cde..ad8678c17a 100644 --- a/test/functional/lua/watch_spec.lua +++ b/test/functional/lua/watch_spec.lua @@ -122,10 +122,6 @@ describe('vim._watch', function() table.insert(events, { path = path, change_type = change_type }) end) - -- polling generates Created events for the existing entries when it starts. - expected_events = expected_events + 1 - wait_for_events() - vim.wait(100) local watched_path = root_dir .. '/file' @@ -158,39 +154,35 @@ describe('vim._watch', function() root_dir ) - eq(5, #result) - eq({ - change_type = exec_lua([[return vim._watch.FileChangeType.Created]]), - path = root_dir, - }, result[1]) + eq(4, #result) eq({ change_type = exec_lua([[return vim._watch.FileChangeType.Created]]), path = root_dir .. '/file', - }, result[2]) + }, result[1]) eq({ change_type = exec_lua([[return vim._watch.FileChangeType.Changed]]), path = root_dir, - }, result[3]) + }, result[2]) -- The file delete and corresponding directory change events do not happen in any -- particular order, so allow either - if result[4].path == root_dir then + if result[3].path == root_dir then eq({ change_type = exec_lua([[return vim._watch.FileChangeType.Changed]]), path = root_dir, - }, result[4]) + }, result[3]) eq({ change_type = exec_lua([[return vim._watch.FileChangeType.Deleted]]), path = root_dir .. '/file', - }, result[5]) + }, result[4]) else eq({ change_type = exec_lua([[return vim._watch.FileChangeType.Deleted]]), path = root_dir .. '/file', - }, result[4]) + }, result[3]) eq({ change_type = exec_lua([[return vim._watch.FileChangeType.Changed]]), path = root_dir, - }, result[5]) + }, result[4]) end end) end) |