Skip to content

Commit

Permalink
feat(types): enums
Browse files Browse the repository at this point in the history
See #334
  • Loading branch information
rcarriga committed Dec 20, 2023
1 parent b8e29c0 commit a2f1cb4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
25 changes: 18 additions & 7 deletions doc/neotest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ See the table of contents for the consumers


Neotest strategies and consumers
See also~
See also ~
|neotest.Config|

Parameters~
Expand Down Expand Up @@ -189,6 +189,7 @@ Default values:
enabled = true,
symbol_queries = {
elixir = <function 1>,
go = " ;query\n ;Captures imported types\n (qualified_type name: (type_identifier) @symbol)\n ;Captures package-local and built-in types\n (type_identifier)@symbol\n ;Captures imported function calls and variables/constants\n (selector_expression field: (field_identifier) @symbol)\n ;Captures package-local functions calls\n (call_expression function: (identifier) @symbol)\n ",
lua = ' ;query\n ;Captures module names in require calls\n (function_call\n name: ((identifier) @function (#eq? @function "require"))\n arguments: (arguments (string) @symbol))\n ',
python = " ;query\n ;Captures imports and modules they're imported from\n (import_from_statement (_ (identifier) @symbol))\n (import_statement (_ (identifier) @symbol))\n "
}
Expand Down Expand Up @@ -626,7 +627,7 @@ A consumer that displays error messages using the vim.diagnostic API.
This consumer is completely passive and so has no interface.

You can configure the diagnostic API for neotest using the "neotest" namespace
See also~
See also ~
|vim.diagnostic.config()|


Expand All @@ -636,7 +637,7 @@ neotest.summary *neotest.summary*

A consumer that displays the structure of the test suite, along with results and
allows running tests.
See also~
See also ~
|neotest.Config.summary.mappings| for all mappings in the summary window

*neotest.summary.open()*
Expand Down Expand Up @@ -817,7 +818,7 @@ partial: boolean))`
{test_focused} `(fun(adapter_id: string, position_id: string)>)`
{starting} `(fun())`
{started} `(fun())`
Type~
Type ~
neotest.Client

*neotest.client.RunTreeArgs*
Expand Down Expand Up @@ -1073,7 +1074,7 @@ Return~
neotest.lib.files.sep *neotest.lib.files.sep*

Path separator for the current OS
Type~
Type ~
`(string)`

*neotest.lib.files.detect_filetype()*
Expand Down Expand Up @@ -1548,17 +1549,27 @@ Parameters~


==============================================================================
*M.PositionType*
`PositionType`

neotest.PositionType

*neotest.Position*
Fields~
{id} `(string)`
{type} `("dir"|"file"|"namespace"|"test")`
{type} `(neotest.PositionType)`
{name} `(string)`
{path} `(string)`
{range} `(integer[])`

*M.ResultStatus*
`ResultStatus`

neotest.ResultStatus

*neotest.Result*
Fields~
{status} `("passed"|"failed"|"skipped")`
{status} `(neotest.ResultStatus)`
{output?} `(string)` Path to file containing full output data
{short?} `(string)` Shortened output string
{errors?} `(neotest.Error[])`
Expand Down
23 changes: 19 additions & 4 deletions lua/neotest/types/init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
local M = {}

---@enum neotest.PositionType
M.PositionType = {
dir = "dir",
file = "file",
namespace = "namespace",
test = "test",
}

---@class neotest.Position
---@field id string
---@field type "dir"|"file"|"namespace"|"test"
---@field type neotest.PositionType
---@field name string
---@field path string
---@field range integer[]

---@enum neotest.ResultStatus
M.ResultStatus = {
passed = "passed",
failed = "failed",
skipped = "skipped",
}

---@class neotest.Result
---@field status "passed"|"failed"|"skipped"
---@field status neotest.ResultStatus
---@field output? string Path to file containing full output data
---@field short? string Shortened output string
---@field errors? neotest.Error[]
Expand Down Expand Up @@ -45,8 +62,6 @@
---@field strategy? table|neotest.Strategy Arguments for strategy or override for chosen strategy
---@field stream fun(output_stream: fun(): string[]): fun(): table<string, neotest.Result>

local M = {}

M.Tree = require("neotest.types.tree")
M.FanoutAccum = require("neotest.types.fanout_accum")

Expand Down

0 comments on commit a2f1cb4

Please sign in to comment.