docs: update (#103)

* chore: add @dochide annotation

- it's easier to distinguish @private and something i dont want to see in docs

* docs: update

* refactor: move thing out to utils

* fix: lua-ls error

* fixup! refactor: move thing out to utils

* docs: update
This commit is contained in:
Smirnov Oleksandr 2025-03-23 15:34:47 +02:00 committed by Oleksandr Smirnov
parent 592fe82760
commit c0b2834652
No known key found for this signature in database
13 changed files with 107 additions and 112 deletions

View file

@ -29,7 +29,7 @@ Requirements:
vim.cmd.GoInstallDeps() vim.cmd.GoInstallDeps()
end, end,
---@type gopher.Config ---@type gopher.Config
opts = {}, -- required opts = {},
} }
``` ```
@ -39,10 +39,11 @@ Requirements:
> >
> If you need more info look `:h gopher.nvim` > If you need more info look `:h gopher.nvim`
**Take a look at default options (might be a bit outdated, look `:h gopher.nvim-config-defaults`)** **Take a look at default options (might be a bit outdated, look `:h gopher.nvim-config`)**
```lua ```lua
require("gopher").setup { require("gopher").setup {
-- log level, you might consider using DEBUG or TRACE for debugging the plugin
log_level = vim.log.levels.INFO, log_level = vim.log.levels.INFO,
-- timeout for running internal commands -- timeout for running internal commands

View file

@ -1,16 +1,16 @@
*gopher.nvim* *gopher.nvim* Enhance your golang experience
MIT License Copyright (c) 2025 Oleksandr Smirnov
============================================================================== ==============================================================================
gopher.nvim is a minimalistic plugin for Go development in Neovim written in Lua. gopher.nvim is a minimalistic plugin for Go development in Neovim written in Lua.
It's not an LSP tool, the main goal of this plugin is add go tooling support in Neovim. It's not an LSP tool, the main goal of this plugin is add go tooling support in Neovim.
------------------------------------------------------------------------------
*gopher.nvim-table-of-contents*
Table of Contents Table of Contents
Setup....................................................|gopher.nvim-setup| Setup..................................................|gopher.nvim-setup()|
Install dependencies..............................|gopher.nvim-install-deps| Install dependencies..............................|gopher.nvim-dependencies|
Configuration...........................................|gopher.nvim-config| Config..................................................|gopher.nvim-config|
Commands..............................................|gopher.nvim-commands| Commands..............................................|gopher.nvim-commands|
Modify struct tags.................................|gopher.nvim-struct-tags| Modify struct tags.................................|gopher.nvim-struct-tags|
Auto implementation of interface methods..................|gopher.nvim-impl| Auto implementation of interface methods..................|gopher.nvim-impl|
@ -19,20 +19,22 @@ Table of Contents
Generate comments.....................................|gopher.nvim-comments| Generate comments.....................................|gopher.nvim-comments|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-setup* *gopher.nvim-setup()*
`gopher.setup`({user_config}) `gopher.setup`({user_config})
Setup function. This method simply merges default config with opts table. Setup function. This method simply merges default config with opts table.
You can read more about configuration at |gopher.nvim-config| You can read more about configuration at |gopher.nvim-config|
Calling this function is optional, if you ok with default settings. Calling this function is optional, if you ok with default settings.
See |gopher.nvim.config-defaults| See |gopher.nvim.config|
Usage ~ Usage ~
`require("gopher").setup {}` (replace `{}` with your `config` table) >lua
require("gopher").setup {} -- use default config or replace {} with your own
<
Parameters ~ Parameters ~
{user_config} `(gopher.Config)` {user_config} `(gopher.Config)` See |gopher.nvim-config|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-install-deps* *gopher.nvim-dependencies*
`gopher.install_deps` `gopher.install_deps`
Gopher.nvim implements most of its features using third-party tools. Gopher.nvim implements most of its features using third-party tools.
To install these tools, you can run `:GoInstallDeps` command To install these tools, you can run `:GoInstallDeps` command
@ -44,17 +46,9 @@ to install them synchronously pass `{sync = true}` as an argument.
============================================================================== ==============================================================================
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-config* *gopher.nvim-config*
config it is the place where you can configure the plugin.
also this is optional is you're ok with default settings.
You can look at default options |gopher.nvim-config-defaults|
------------------------------------------------------------------------------
*gopher.nvim-config-defaults*
`default_config` `default_config`
>lua >lua
local default_config = { local default_config = {
--minidoc_replace_end
-- log level, you might consider using DEBUG or TRACE for debugging the plugin -- log level, you might consider using DEBUG or TRACE for debugging the plugin
---@type number ---@type number
log_level = vim.log.levels.INFO, log_level = vim.log.levels.INFO,
@ -112,15 +106,18 @@ you can set `vim.g.gopher_register_commands` to `false`, before loading the plug
============================================================================== ==============================================================================
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-struct-tags* *gopher.nvim-struct-tags*
struct-tags is utilizing the `gomodifytags` tool to add or remove tags to struct fields.
`struct_tags` is utilizing the `gomodifytags` tool to add or remove tags to struct fields.
Usage ~ Usage ~
How to add/remove tags to struct fields: How to add/remove tags to struct fields:
1. Place cursor on the struct
------------------------------------------------------------------------------
2. Run `:GoTagAdd json` to add json tags to struct fields 2. Run `:GoTagAdd json` to add json tags to struct fields
3. Run `:GoTagRm json` to remove json tags to struct fields 3. Run `:GoTagRm json` to remove json tags to struct fields
To clear all tags from struct run: `:GoTagClear`
NOTE: if you dont specify the tag it will use `json` as default NOTE: if you dont specify the tag it will use `json` as default
Example: Example:
@ -139,32 +136,14 @@ Example:
Name string `yaml:name` Name string `yaml:name`
} }
< <
------------------------------------------------------------------------------
*struct_tags.add()*
`struct_tags.add`({...})
tags to a struct under the cursor
Parameters ~
{...} `(string)` Tags to add to the struct fields. If not provided, it will use [config.gotag.default_tag]
------------------------------------------------------------------------------
*struct_tags.remove()*
`struct_tags.remove`({...})
tags from a struct under the cursor
Parameters ~
{...} `(string)` Tags to add to the struct fields. If not provided, it will use [config.gotag.default_tag]
------------------------------------------------------------------------------
*struct_tags.clear()*
`struct_tags.clear`()
all tags from a struct under the cursor
============================================================================== ==============================================================================
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-impl* *gopher.nvim-impl*
impl is utilizing the `impl` tool to generate method stubs for interfaces.
Usage ~
Integration of `impl` tool to generate method stubs for interfaces.
Usage ~
1. Automatically implement an interface for a struct: 1. Automatically implement an interface for a struct:
- Place your cursor on the struct where you want to implement the interface. - Place your cursor on the struct where you want to implement the interface.
- Run `:GoImpl io.Reader` - Run `:GoImpl io.Reader`
@ -214,17 +193,16 @@ Usage ~
You can also specify the template to use for generating the tests. See |gopher.nvim-config| You can also specify the template to use for generating the tests. See |gopher.nvim-config|
More details about templates can be found at: https://github.com/cweill/gotests More details about templates can be found at: https://github.com/cweill/gotests
------------------------------------------------------------------------------ If you prefer named tests, you can enable them in |gopher.nvim-config|.
*gopher.nvim-gotests-named*
You can enable named tests in the config if you prefer using named tests.
See |gopher.nvim-config|.
============================================================================== ==============================================================================
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-iferr* *gopher.nvim-iferr*
If you're using `iferr` tool, this module provides a way to automatically insert `if err != nil` check.
`iferr` provides a way to way to automatically insert `if err != nil` check.
If you want to change `-message` option of `iferr` tool, see |gopher.nvim-config|
Usage ~ Usage ~
Execute `:GoIfErr` near any `err` variable to insert the check Execute `:GoIfErr` near any `err` variable to insert the check
@ -232,9 +210,11 @@ Execute `:GoIfErr` near any `err` variable to insert the check
============================================================================== ==============================================================================
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*gopher.nvim-comments* *gopher.nvim-comments*
Usage ~
Execute `:GoCmt` to generate a comment for the current function/method/struct/etc on this line.
This module provides a way to generate comments for Go code. This module provides a way to generate comments for Go code.
Usage ~
Set cursor on line with function/method/struct/etc and run `:GoCmt` to generate a comment.
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl:

View file

@ -7,6 +7,7 @@ local utils = {}
function utils.notify(msg, lvl) function utils.notify(msg, lvl)
lvl = lvl or vim.log.levels.INFO lvl = lvl or vim.log.levels.INFO
vim.notify(msg, lvl, { vim.notify(msg, lvl, {
---@diagnostic disable-next-line:undefined-field
title = c.___plugin_name, title = c.___plugin_name,
}) })
log.debug(msg) log.debug(msg)
@ -30,4 +31,11 @@ function utils.remove_empty_lines(t)
return res return res
end end
---@param s string
---@return string
function utils.trimend(s)
local r, _ = string.gsub(s, "%s+$", "")
return r
end
return utils return utils

View file

@ -18,6 +18,7 @@ local c = require "gopher.config"
local config = { local config = {
-- Name of the plugin. Prepended to log messages -- Name of the plugin. Prepended to log messages
---@diagnostic disable-next-line:undefined-field
name = c.___plugin_name, name = c.___plugin_name,
-- Should print the output to neovim while running -- Should print the output to neovim while running

View file

@ -1,7 +1,9 @@
---@toc_entry Generate comments ---@toc_entry Generate comments
---@tag gopher.nvim-comments ---@tag gopher.nvim-comments
---@usage Execute `:GoCmt` to generate a comment for the current function/method/struct/etc on this line. ---@text
---@text This module provides a way to generate comments for Go code. --- This module provides a way to generate comments for Go code.
---
---@usage Set cursor on line with function/method/struct/etc and run `:GoCmt` to generate a comment.
local ts = require "gopher._utils.ts" local ts = require "gopher._utils.ts"
local log = require "gopher._utils.log" local log = require "gopher._utils.log"
@ -9,14 +11,14 @@ local comment = {}
---@param name string ---@param name string
---@return string ---@return string
---@private ---@dochide
local function template(name) local function template(name)
return "// " .. name .. " " return "// " .. name .. " "
end end
---@param bufnr integer ---@param bufnr integer
---@return string ---@return string
---@private ---@dochide
local function generate(bufnr) local function generate(bufnr)
local s_ok, s_res = pcall(ts.get_struct_under_cursor, bufnr) local s_ok, s_res = pcall(ts.get_struct_under_cursor, bufnr)
if s_ok then if s_ok then

View file

@ -1,17 +1,9 @@
---@toc_entry Configuration
---@tag gopher.nvim-config
---@text config it is the place where you can configure the plugin.
--- also this is optional is you're ok with default settings.
--- You can look at default options |gopher.nvim-config-defaults|
---@type gopher.Config
---@private
local config = {} local config = {}
---@tag gopher.nvim-config.ConfigGoTagTransform ---@tag gopher.nvim-config.ConfigGoTagTransform
---@text Possible values for |gopher.Config|.gotag.transform: ---@text Possible values for |gopher.Config|.gotag.transform:
--- ---
---@private ---@dochide
---@alias gopher.ConfigGoTagTransform ---@alias gopher.ConfigGoTagTransform
---| "snakecase" "GopherUser" -> "gopher_user" ---| "snakecase" "GopherUser" -> "gopher_user"
---| "camelcase" "GopherUser" -> "gopherUser" ---| "camelcase" "GopherUser" -> "gopherUser"
@ -20,15 +12,11 @@ local config = {}
---| "titlecase" "GopherUser" -> "Gopher User" ---| "titlecase" "GopherUser" -> "Gopher User"
---| "keep" keeps the original field name ---| "keep" keeps the original field name
--minidoc_replace_start { ---@toc_entry Config
---@tag gopher.nvim-config
---@tag gopher.nvim-config-defaults
---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section) ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
---
---@class gopher.Config ---@class gopher.Config
local default_config = { local default_config = {
--minidoc_replace_end
-- log level, you might consider using DEBUG or TRACE for debugging the plugin -- log level, you might consider using DEBUG or TRACE for debugging the plugin
---@type number ---@type number
log_level = vim.log.levels.INFO, log_level = vim.log.levels.INFO,
@ -73,7 +61,7 @@ local default_config = {
--minidoc_afterlines_end --minidoc_afterlines_end
---@type gopher.Config ---@type gopher.Config
---@private ---@dochide
local _config = default_config local _config = default_config
-- I am kinda secret so don't tell anyone about me even dont use me -- I am kinda secret so don't tell anyone about me even dont use me
@ -84,7 +72,7 @@ local _config = default_config
_config.___plugin_name = "gopher.nvim" ---@diagnostic disable-line: inject-field _config.___plugin_name = "gopher.nvim" ---@diagnostic disable-line: inject-field
---@param user_config? gopher.Config ---@param user_config? gopher.Config
---@private ---@dochide
function config.setup(user_config) function config.setup(user_config)
vim.validate { user_config = { user_config, "table", true } } vim.validate { user_config = { user_config, "table", true } }
@ -117,6 +105,6 @@ setmetatable(config, {
end, end,
}) })
---@dochide
---@return gopher.Config ---@return gopher.Config
---@private
return config return config

View file

@ -15,11 +15,7 @@
--- You can also specify the template to use for generating the tests. See |gopher.nvim-config| --- You can also specify the template to use for generating the tests. See |gopher.nvim-config|
--- More details about templates can be found at: https://github.com/cweill/gotests --- More details about templates can be found at: https://github.com/cweill/gotests
--- ---
--- If you prefer named tests, you can enable them in |gopher.nvim-config|.
---@tag gopher.nvim-gotests-named
---@text
--- You can enable named tests in the config if you prefer using named tests.
--- See |gopher.nvim-config|.
local c = require "gopher.config" local c = require "gopher.config"
local ts_utils = require "gopher._utils.ts" local ts_utils = require "gopher._utils.ts"
@ -29,7 +25,7 @@ local log = require "gopher._utils.log"
local gotests = {} local gotests = {}
---@param args table ---@param args table
---@private ---@dochide
local function add_test(args) local function add_test(args)
if c.gotests.named then if c.gotests.named then
table.insert(args, "-named") table.insert(args, "-named")

View file

@ -1,6 +1,11 @@
-- Thanks https://github.com/koron/iferr for vim implementation
---@toc_entry Iferr ---@toc_entry Iferr
---@tag gopher.nvim-iferr ---@tag gopher.nvim-iferr
---@text If you're using `iferr` tool, this module provides a way to automatically insert `if err != nil` check. ---@text
--- `iferr` provides a way to way to automatically insert `if err != nil` check.
--- If you want to change `-message` option of `iferr` tool, see |gopher.nvim-config|
---
---@usage Execute `:GoIfErr` near any `err` variable to insert the check ---@usage Execute `:GoIfErr` near any `err` variable to insert the check
local c = require "gopher.config" local c = require "gopher.config"
@ -9,7 +14,6 @@ local r = require "gopher._utils.runner"
local log = require "gopher._utils.log" local log = require "gopher._utils.log"
local iferr = {} local iferr = {}
-- That's Lua implementation: https://github.com/koron/iferr
function iferr.iferr() function iferr.iferr()
local curb = vim.fn.wordcount().cursor_bytes local curb = vim.fn.wordcount().cursor_bytes
local pos = vim.fn.getcurpos()[2] local pos = vim.fn.getcurpos()[2]

View file

@ -1,8 +1,9 @@
---@toc_entry Auto implementation of interface methods ---@toc_entry Auto implementation of interface methods
---@tag gopher.nvim-impl ---@tag gopher.nvim-impl
---@text impl is utilizing the `impl` tool to generate method stubs for interfaces. ---@text
---@usage --- Integration of `impl` tool to generate method stubs for interfaces.
--- 1. Automatically implement an interface for a struct: ---
---@usage 1. Automatically implement an interface for a struct:
--- - Place your cursor on the struct where you want to implement the interface. --- - Place your cursor on the struct where you want to implement the interface.
--- - Run `:GoImpl io.Reader` --- - Run `:GoImpl io.Reader`
--- - This will automatically determine the receiver and implement the `io.Reader` interface. --- - This will automatically determine the receiver and implement the `io.Reader` interface.

View file

@ -1,12 +1,13 @@
--- *gopher.nvim* --- *gopher.nvim* Enhance your golang experience
---
--- MIT License Copyright (c) 2025 Oleksandr Smirnov
--- ---
--- ============================================================================== --- ==============================================================================
--- ---
--- gopher.nvim is a minimalistic plugin for Go development in Neovim written in Lua. --- gopher.nvim is a minimalistic plugin for Go development in Neovim written in Lua.
--- It's not an LSP tool, the main goal of this plugin is add go tooling support in Neovim. --- It's not an LSP tool, the main goal of this plugin is add go tooling support in Neovim.
---
--- Table of Contents --- Table of Contents
---@tag gopher.nvim-table-of-contents
---@toc ---@toc
local log = require "gopher._utils.log" local log = require "gopher._utils.log"
@ -16,14 +17,16 @@ local gocmd = require("gopher._utils.gocmd").run
local gopher = {} local gopher = {}
---@toc_entry Setup ---@toc_entry Setup
---@tag gopher.nvim-setup ---@tag gopher.nvim-setup()
---@text Setup function. This method simply merges default config with opts table. ---@text Setup function. This method simply merges default config with opts table.
--- You can read more about configuration at |gopher.nvim-config| --- You can read more about configuration at |gopher.nvim-config|
--- Calling this function is optional, if you ok with default settings. --- Calling this function is optional, if you ok with default settings.
--- See |gopher.nvim.config-defaults| --- See |gopher.nvim.config|
--- ---
---@usage `require("gopher").setup {}` (replace `{}` with your `config` table) ---@usage >lua
---@param user_config gopher.Config --- require("gopher").setup {} -- use default config or replace {} with your own
--- <
---@param user_config gopher.Config See |gopher.nvim-config|
gopher.setup = function(user_config) gopher.setup = function(user_config)
log.debug "setting up config" log.debug "setting up config"
require("gopher.config").setup(user_config) require("gopher.config").setup(user_config)
@ -31,7 +34,7 @@ gopher.setup = function(user_config)
end end
---@toc_entry Install dependencies ---@toc_entry Install dependencies
---@tag gopher.nvim-install-deps ---@tag gopher.nvim-dependencies
---@text Gopher.nvim implements most of its features using third-party tools. ---@text Gopher.nvim implements most of its features using third-party tools.
--- To install these tools, you can run `:GoInstallDeps` command --- To install these tools, you can run `:GoInstallDeps` command
--- or call `require("gopher").install_deps()` if you want to use lua api. --- or call `require("gopher").install_deps()` if you want to use lua api.

View file

@ -1,12 +1,16 @@
---@toc_entry Modify struct tags ---@toc_entry Modify struct tags
---@tag gopher.nvim-struct-tags ---@tag gopher.nvim-struct-tags
---@text struct-tags is utilizing the `gomodifytags` tool to add or remove tags to struct fields. ---@text
--- `struct_tags` is utilizing the `gomodifytags` tool to add or remove tags to struct fields.
---
---@usage ---@usage
--- How to add/remove tags to struct fields: --- How to add/remove tags to struct fields:
-- 1. Place cursor on the struct --- 1. Place cursor on the struct
--- 2. Run `:GoTagAdd json` to add json tags to struct fields --- 2. Run `:GoTagAdd json` to add json tags to struct fields
--- 3. Run `:GoTagRm json` to remove json tags to struct fields --- 3. Run `:GoTagRm json` to remove json tags to struct fields
--- ---
--- To clear all tags from struct run: `:GoTagClear`
---
--- NOTE: if you dont specify the tag it will use `json` as default --- NOTE: if you dont specify the tag it will use `json` as default
--- ---
--- Example: --- Example:
@ -29,13 +33,14 @@
local ts = require "gopher._utils.ts" local ts = require "gopher._utils.ts"
local r = require "gopher._utils.runner" local r = require "gopher._utils.runner"
local c = require "gopher.config" local c = require "gopher.config"
local u = require "gopher._utils"
local log = require "gopher._utils.log" local log = require "gopher._utils.log"
local struct_tags = {} local struct_tags = {}
---@param fpath string ---@param fpath string
---@param bufnr integer ---@param bufnr integer
---@param user_args string[] ---@param user_args string[]
---@private ---@dochide
local function handle_tags(fpath, bufnr, user_args) local function handle_tags(fpath, bufnr, user_args)
local st = ts.get_struct_under_cursor(bufnr) local st = ts.get_struct_under_cursor(bufnr)
@ -73,7 +78,7 @@ local function handle_tags(fpath, bufnr, user_args)
end end
for i, v in ipairs(res["lines"]) do for i, v in ipairs(res["lines"]) do
res["lines"][i] = string.gsub(v, "%s+$", "") res["lines"][i] = u.trimend(v)
end end
vim.api.nvim_buf_set_lines( vim.api.nvim_buf_set_lines(
@ -87,7 +92,7 @@ end
---@param args string[] ---@param args string[]
---@return string ---@return string
---@private ---@dochide
local function handler_user_args(args) local function handler_user_args(args)
if #args == 0 then if #args == 0 then
return c.gotag.default_tag return c.gotag.default_tag
@ -95,8 +100,10 @@ local function handler_user_args(args)
return table.concat(args, ",") return table.concat(args, ",")
end end
---Adds tags to a struct under the cursor -- Adds tags to a struct under the cursor
-- See |gopher.nvim-struct-tags|
---@param ... string Tags to add to the struct fields. If not provided, it will use [config.gotag.default_tag] ---@param ... string Tags to add to the struct fields. If not provided, it will use [config.gotag.default_tag]
---@dochide
function struct_tags.add(...) function struct_tags.add(...)
local args = { ... } local args = { ... }
local fpath = vim.fn.expand "%" local fpath = vim.fn.expand "%"
@ -106,7 +113,9 @@ function struct_tags.add(...)
handle_tags(fpath, bufnr, { "-add-tags", user_tags }) handle_tags(fpath, bufnr, { "-add-tags", user_tags })
end end
---Removes tags from a struct under the cursor -- Removes tags from a struct under the cursor
-- See `:h gopher.nvim-struct-tags`
---@dochide
---@param ... string Tags to add to the struct fields. If not provided, it will use [config.gotag.default_tag] ---@param ... string Tags to add to the struct fields. If not provided, it will use [config.gotag.default_tag]
function struct_tags.remove(...) function struct_tags.remove(...)
local args = { ... } local args = { ... }
@ -117,7 +126,9 @@ function struct_tags.remove(...)
handle_tags(fpath, bufnr, { "-remove-tags", user_tags }) handle_tags(fpath, bufnr, { "-remove-tags", user_tags })
end end
---Removes all tags from a struct under the cursor -- Removes all tags from a struct under the cursor
-- See `:h gopher.nvim-struct-tags`
---@dochide
function struct_tags.clear() function struct_tags.clear()
local fpath = vim.fn.expand "%" local fpath = vim.fn.expand "%"
local bufnr = vim.api.nvim_get_current_buf() local bufnr = vim.api.nvim_get_current_buf()

View file

@ -30,4 +30,8 @@ hooks.write_pre = function(lines)
return lines return lines
end end
hooks.sections["@dochide"] = function(s)
s.parent:clear_lines()
end
MiniDoc.generate(files, "doc/gopher.nvim.txt", { hooks = hooks }) MiniDoc.generate(files, "doc/gopher.nvim.txt", { hooks = hooks })

View file

@ -1,15 +1,6 @@
local t = require "spec.testutils" local t = require "spec.testutils"
local child = MiniTest.new_child_neovim() local _, T = t.setup "utils"
local T = MiniTest.new_set {
hooks = {
post_once = child.stop,
pre_case = function()
child.restart { "-u", t.mininit_path }
end,
},
}
T["utils"] = MiniTest.new_set()
T["utils"]["should .remove_empty_lines()"] = function() T["utils"]["should .remove_empty_lines()"] = function()
local u = require "gopher._utils" local u = require "gopher._utils"
local inp = { "hi", "", "a", "", "", "asdf" } local inp = { "hi", "", "a", "", "", "asdf" }
@ -26,4 +17,9 @@ T["utils"]["should .readfile_joined()"] = function()
t.eq(u.readfile_joined(tmp), data) t.eq(u.readfile_joined(tmp), data)
end end
T["utils"]["should .trimend()"] = function()
local u = require "gopher._utils"
t.eq(u.trimend " hi ", " hi")
end
return T return T