diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-04-13 17:34:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 17:34:47 +0100 |
commit | 66c66d8db8ab5cb6d0c6d85d64556d7cf20b04fa (patch) | |
tree | 4bd6437962646f96ff4928f9d7479194b7195d2f /test/functional/lua/loader_spec.lua | |
parent | b85ac89326d11461de4d40d6e317d154ee6a0d2c (diff) | |
download | rneovim-66c66d8db8ab5cb6d0c6d85d64556d7cf20b04fa.tar.gz rneovim-66c66d8db8ab5cb6d0c6d85d64556d7cf20b04fa.tar.bz2 rneovim-66c66d8db8ab5cb6d0c6d85d64556d7cf20b04fa.zip |
fix(loader): reset hashes when running the loader
Diffstat (limited to 'test/functional/lua/loader_spec.lua')
-rw-r--r-- | test/functional/lua/loader_spec.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/lua/loader_spec.lua b/test/functional/lua/loader_spec.lua new file mode 100644 index 0000000000..e2958d1592 --- /dev/null +++ b/test/functional/lua/loader_spec.lua @@ -0,0 +1,36 @@ +-- Test suite for testing interactions with API bindings +local helpers = require('test.functional.helpers')(after_each) + +local exec_lua = helpers.exec_lua +local command = helpers.command +local eq = helpers.eq + +describe('vim.loader', function() + before_each(helpers.clear) + + it('handles changing files (#23027)', function() + exec_lua[[ + vim.loader.enable() + ]] + + local tmp = helpers.tmpname() + command('edit ' .. tmp) + + eq(1, exec_lua([[ + vim.api.nvim_buf_set_lines(0, 0, -1, true, {'_G.TEST=1'}) + vim.cmd.write() + loadfile(...)() + return _G.TEST + ]], tmp)) + + -- fs latency + helpers.sleep(10) + + eq(2, exec_lua([[ + vim.api.nvim_buf_set_lines(0, 0, -1, true, {'_G.TEST=2'}) + vim.cmd.write() + loadfile(...)() + return _G.TEST + ]], tmp)) + end) +end) |