2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
- name: Compile Needed Parsers
|
||||
working-directory: ./neogen
|
||||
run: |
|
||||
nvim -u tests/minimal_init.lua --headless -c "TSInstallSync python lua julia" -c "q"
|
||||
nvim -u tests/minimal_init.lua --headless -c "TSInstallSync python lua julia java" -c "q"
|
||||
|
||||
- name: Run tests
|
||||
working-directory: ./neogen
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local extractors = require("neogen.utilities.extractors")
|
||||
local nodes_utils = require("neogen.utilities.nodes")
|
||||
local template = require("neogen.template")
|
||||
local i = require("neogen.types.template").item
|
||||
|
||||
local function_tree = {
|
||||
{
|
||||
@@ -28,7 +29,7 @@ local function_tree = {
|
||||
node_type = "block|constructor_body",
|
||||
subtree = {
|
||||
{ retrieve = "first", node_type = "return_statement", extract = true },
|
||||
{ retrieve = "all", recursive = true, node_type = "throw_statement", extract = true },
|
||||
{ retrieve = "all", recursive = true, node_type = "throw_statement", extract = true },
|
||||
{
|
||||
retrieve = "first",
|
||||
node_type = "try_statement",
|
||||
@@ -52,7 +53,7 @@ local function_tree = {
|
||||
|
||||
return {
|
||||
parent = {
|
||||
class = { "class_declaration" },
|
||||
class = { "class_declaration", "interface_declaration" },
|
||||
func = { "method_declaration", "constructor_declaration" },
|
||||
},
|
||||
|
||||
@@ -103,8 +104,23 @@ return {
|
||||
local nodes = nodes_utils:matching_nodes_from(node, tree)
|
||||
local res = extractors:extract_from_matched(nodes)
|
||||
|
||||
results.class_name = res.identifier
|
||||
return results
|
||||
return {
|
||||
[i.ClassName] = res.identifier
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
["interface_declaration"] = {
|
||||
["0"] = {
|
||||
extract = function(node)
|
||||
local results = {}
|
||||
local tree = { { retrieve = "all", node_type = "identifier", extract = true } }
|
||||
local nodes = nodes_utils:matching_nodes_from(node, tree)
|
||||
local res = extractors:extract_from_matched(nodes)
|
||||
|
||||
return {
|
||||
[i.ClassName] = res.identifier
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ return {
|
||||
parent = {
|
||||
type = { "property_declaration", "const_declaration", "foreach_statement" },
|
||||
func = { "function_definition", "method_declaration" },
|
||||
class = { "class_declaration" },
|
||||
class = { "class_declaration", "interface_declaration" },
|
||||
},
|
||||
data = {
|
||||
type = {
|
||||
@@ -83,6 +83,13 @@ return {
|
||||
end,
|
||||
},
|
||||
},
|
||||
["interface_declaration"] = {
|
||||
["0"] = {
|
||||
extract = function()
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
template = template:add_default_annotation("phpdoc"),
|
||||
|
||||
@@ -309,7 +309,7 @@ end
|
||||
--- with multiple annotation conventions.
|
||||
---@tag neogen-changelog
|
||||
---@toc_entry Changes in neogen plugin
|
||||
neogen.version = "2.19.2"
|
||||
neogen.version = "2.19.3"
|
||||
--minidoc_afterlines_end
|
||||
|
||||
return neogen
|
||||
|
||||
@@ -21,13 +21,4 @@ require("plenary.busted")
|
||||
|
||||
vim.cmd("runtime plugin/nvim-treesitter.lua")
|
||||
|
||||
-- -- Some tests require the Python parser
|
||||
-- -- vim.cmd([[TSInstallSync! python]])
|
||||
-- require("nvim-treesitter.configs").setup({
|
||||
-- ensured_installed = {
|
||||
-- "python",
|
||||
-- "lua"
|
||||
-- }
|
||||
-- })
|
||||
|
||||
require("neogen").setup({ snippet_engine = "nvim" })
|
||||
|
||||
35
tests/neogen/java_javadoc_spec.lua
Normal file
35
tests/neogen/java_javadoc_spec.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
--- Test cases for emmylua
|
||||
---
|
||||
--- @module 'tests.neogen.lua_spec'
|
||||
|
||||
local specs = require('tests.utils.specs')
|
||||
|
||||
local function make_emmylua(source, type)
|
||||
return specs.make_docstring(source, 'java', { type = type, annotation_convention = { java = 'javadoc' } })
|
||||
end
|
||||
|
||||
describe("java: javadoc", function()
|
||||
describe("class", function()
|
||||
it("works with an basic interface", function()
|
||||
local source = [[
|
||||
public interface Entity {
|
||||
@NonNull UUID getId();|cursor|
|
||||
}
|
||||
]]
|
||||
|
||||
local expected = [[
|
||||
/**
|
||||
* [TODO:description]
|
||||
*
|
||||
*/
|
||||
public interface Entity {
|
||||
@NonNull UUID getId();
|
||||
}
|
||||
]]
|
||||
|
||||
local result = make_emmylua(source, "class")
|
||||
|
||||
assert.equal(expected, result)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user