Mini.test get value from "vim.fn.getreg('*')" ? #1092
-
I understand many APIs in T['copy_apex_name()']['return apex name'] = function()
local apex_name = 'SfProject'
local lua_cmd = string.format('edit tests/dir/sf-project/%s.cls', apex_name)
child.cmd(lua_cmd)
child.type_keys('<leader>cc') -- copy name 'SfProject' into "*" registration
eq(child.lua_get('vim.bo.filetype'), 'apex') -- works
eq(child.bo.filetype, 'apex') -- works
eq(child.lua_get('vim.fn.getreg("*")'), apex_name) -- it gets the registration value from the current Nvim instance rather than the test child.
eq(child.fn.getreg("*"), apex_name) -- same as above line
end
end |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
So the Test result:
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately, working with system register is indeed a bit messy. The reason (I think) is mostly because it is something shared by both instances and that Neovim has special treatment of system clipboard (see Here is one example of how I get over it.
The answer would have been more helpful if you posted a fully reproducible (and small-ish) test case. For example, the following test case passes locally for me: T['tmp'] = function()
child.fn.setreg('*', 'Hello')
eq(child.fn.getreg('*'), 'Hello')
end |
Beta Was this translation helpful? Give feedback.
Unfortunately, working with system register is indeed a bit messy. The reason (I think) is mostly because it is something shared by both instances and that Neovim has special treatment of system clipboard (see
:h clipboard
).Here is one example of how I get over it.
The answer would have been more helpful if you posted a fully reproducible (and small-ish) test case. For example, the following test case passes locally for me: