mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
support for elixir exunit tests
This commit is contained in:
parent
9921808e0d
commit
391e68350d
3 changed files with 83 additions and 0 deletions
|
@ -57,3 +57,18 @@
|
|||
target: (identifier) @identifier (#eq? @identifier "defstruct")) @type
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
; describe("Unit test")
|
||||
(call
|
||||
target: (identifier) @identifier (#any-of? @identifier "describe" "test")
|
||||
(arguments [(string (quoted_content) @name)])
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
|
||||
; describe("Unit test")
|
||||
(do_block
|
||||
(call
|
||||
target: (identifier) @identifier @name (#eq? @identifier "setup")) @type
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
|
||||
|
|
|
@ -175,6 +175,55 @@ describe("treesitter elixir", function()
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
kind = "Module",
|
||||
name = "StringTest",
|
||||
level = 0,
|
||||
lnum = 43,
|
||||
col = 0,
|
||||
end_lnum = 59,
|
||||
end_col = 3,
|
||||
children = {
|
||||
{
|
||||
kind = "Function",
|
||||
name = "String.capitalize/1",
|
||||
level = 1,
|
||||
lnum = 46,
|
||||
col = 2,
|
||||
end_lnum = 58,
|
||||
end_col = 5,
|
||||
children = {
|
||||
{
|
||||
kind = "Function",
|
||||
name = "setup",
|
||||
level = 2,
|
||||
lnum = 47,
|
||||
col = 4,
|
||||
end_lnum = 49,
|
||||
end_col = 7,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "first grapheme is in uppercase",
|
||||
level = 2,
|
||||
lnum = 51,
|
||||
col = 4,
|
||||
end_lnum = 53,
|
||||
end_col = 7,
|
||||
},
|
||||
{
|
||||
kind = "Function",
|
||||
name = "converts remaining graphemes to lowercase",
|
||||
level = 2,
|
||||
lnum = 55,
|
||||
col = 4,
|
||||
end_lnum = 57,
|
||||
end_col = 7,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -38,3 +38,22 @@ defimpl Example.Protocol, for: Map do
|
|||
true
|
||||
end
|
||||
end
|
||||
|
||||
# https://hexdocs.pm/ex_unit/ExUnit.Case.html#describe/2-examples
|
||||
defmodule StringTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
describe "String.capitalize/1" do
|
||||
setup do
|
||||
# setup code
|
||||
end
|
||||
|
||||
test "first grapheme is in uppercase" do
|
||||
assert String.capitalize("hello") == "Hello"
|
||||
end
|
||||
|
||||
test "converts remaining graphemes to lowercase" do
|
||||
assert String.capitalize("HELLO") == "Hello"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue