Closed she3o closed 7 months ago
Hi, I think this PR is mature enough now. I will fix any shortsightedness and implement some of the pending tests after my work shift.
With make test
I got this:
tmp-R-Nvim (test-infrastructure|✔) » make test ~/src/she3o_tmp-R-Nvim
eval $(luarocks path --lua-version 5.1 --bin) && busted --run r_tests
Adding plenary.nvim: https://github.com/nvim-lua/plenary.nvim -> tests/xdg/local/share/nvim/site/pack/testing/start/plenary.nvim
fatal: 'tests/xdg/local/share/nvim/site/pack/testing/start/plenary.nvim' already exists in the index
Adding nvim-treesitter: https://github.com/nvim-treesitter/nvim-treesitter -> tests/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter
fatal: 'tests/xdg/local/share/nvim/site/pack/testing/start/nvim-treesitter' already exists in the index
Testing dependencies are now available.
●●●●◼◌◌◌◌●●●Error creating directory: Vim:E739: Cannot create directory /create_me: permission denied●
8 successes / 1 failure / 0 errors / 4 pending : 0.167151 seconds
Pending → ./tests/r/rmd_spec.lua @ 57
rmd module is_in_code_chunk(language, verbose) Unit Tests test verbosity
./tests/r/rmd_spec.lua:57: test verbosity
Pending → ./tests/r/rmd_spec.lua @ 60
rmd module is_in_code_chunk(language, verbose) Unit Tests returns true if inside code chunk (filetype-agnostic)
./tests/r/rmd_spec.lua:60: test filetype-agnostic code chunk detection
Pending → ./tests/r/rmd_spec.lua @ 64
rmd module is_in_code_chunk(language, verbose) Unit Tests returns false if outside code chunk (filetype-agnostic)
./tests/r/rmd_spec.lua:64: test filetype-agnostic code chunk detection
Pending → ./tests/r/rmd_spec.lua @ 68
rmd module is_in_code_chunk(language, verbose) Unit Tests returns false if it cannot match ```
./tests/r/rmd_spec.lua:68: test behaviour if chunk start/end not found
Failure → ./tests/r/rmd_spec.lua @ 51
rmd module is_in_code_chunk(language, verbose) Unit Tests returns true if on an '```{r' line
./tests/r/rmd_spec.lua:55: Expected objects to be the same.
Passed in:
(boolean) false
Expected:
(boolean) true
E5113: Error while calling lua chunk: [NULL]
make: *** [Makefile:11: test] Error 1
make test
fails because the following test fails
it("returns true if on an '```{r' line", function()
rpcrequest(nvim, "nvim_win_set_cursor", 0, { 12, 0 })
local result =
send_lua_via_rpc([[return require('r.rmd').is_in_code_chunk('r', false)]])
assert.is_true(result)
end)
I think it's expected from this function to return true if The cursor is on ```{r (I would still consider the cursor in a code chunk).
I will make the Makefile more error-friendly.
Hello @jalvesaq,
I'm looking to proceed with merging this pull request and plan to begin crafting tests in subsequent PRs. Could you confirm if this PR is complete and ready for merging, or is there anything else needed before it can be finalized?
I'm getting this:
Failure → ./tests/r/rmd_spec.lua @ 58
rmd module is_in_code_chunk(language, verbose) Unit Tests returns true if on an '```{r' line
./tests/r/rmd_spec.lua:62: Expected objects to be the same.
Passed in:
(boolean) false
Expected:
(boolean) true
E5113: Error while calling lua chunk: [NULL]
The problem is that line 12 is not R code. It's the chunk header. The R code is line 13.
Ok that makes sense. I will remove it.
If there are no more adjustments required with this PR. Please feel free to proceed with the merging. @jalvesaq
I merged it. Thanks! The chunk test should work if you have changed the line from 12 to 13.
.busted
for Lua tests, specifying custom test runner.tests/run
as a Lua interpreter wrapper for Neovim.tests/init.lua
andrmd_spec.lua
for new testing infrastructure.This commit will allow us to test the plugin in a live Neovim session. It also includes TODOs and
pending()
for future implementation.