From b905ed04edba5aeea363716d057423c7052c015a Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 1 Mar 2026 17:25:34 -0500 Subject: [PATCH] ci: format --- README.md | 8 ++++---- selene.toml | 2 +- spec/helpers.lua | 4 ++-- spec/init_spec.lua | 20 +++++++------------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5dc1795..6c2ca46 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ Async document compilation for Neovim. A framework for compiling documents (LaTeX, Typst, Markdown, etc.) -asynchronously with error diagnostics. Ships with zero defaults — you -configure your own providers. +asynchronously with error diagnostics. Ships with zero defaults — you configure +your own providers. ## Features - Async compilation via `vim.system()` - Compiler errors as native `vim.diagnostic` -- User events for extensibility (`RenderCompileStarted`, - `RenderCompileSuccess`, `RenderCompileFailed`) +- User events for extensibility (`RenderCompileStarted`, `RenderCompileSuccess`, + `RenderCompileFailed`) - `:checkhealth` integration - Zero dependencies beyond Neovim 0.10.0+ diff --git a/selene.toml b/selene.toml index 83d196e..d1a5818 100644 --- a/selene.toml +++ b/selene.toml @@ -1,5 +1,5 @@ std = 'vim' -exclude = ['.direnv', 'result', 'result-*', 'node_modules'] +exclude = ['.direnv/*', 'result/*', 'node_modules/*'] [lints] bad_string_escape = 'allow' diff --git a/spec/helpers.lua b/spec/helpers.lua index f337dd2..605f3b5 100644 --- a/spec/helpers.lua +++ b/spec/helpers.lua @@ -19,8 +19,8 @@ function M.delete_buffer(bufnr) end end -function M.reset_config() - vim.g.render = nil +function M.reset_config(opts) + vim.g.render = opts require('render')._test.reset() end diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 1a2d82a..1005e16 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua @@ -10,14 +10,12 @@ describe('render', function() describe('config', function() it('accepts nil config', function() - vim.g.render = nil assert.has_no.errors(function() render.get_config() end) end) it('applies default values', function() - vim.g.render = nil local config = render.get_config() assert.is_false(config.debug) assert.are.same({}, config.providers) @@ -25,15 +23,14 @@ describe('render', function() end) it('merges user config with defaults', function() - vim.g.render = { debug = true } - helpers.reset_config() + helpers.reset_config({ debug = true }) local config = require('render').get_config() assert.is_true(config.debug) assert.are.same({}, config.providers) end) it('accepts full provider config', function() - vim.g.render = { + helpers.reset_config({ providers = { typst = { cmd = { 'typst', 'compile' }, @@ -43,8 +40,7 @@ describe('render', function() providers_by_ft = { typst = 'typst', }, - } - helpers.reset_config() + }) local config = require('render').get_config() assert.is_not_nil(config.providers.typst) assert.are.equal('typst', config.providers_by_ft.typst) @@ -53,15 +49,14 @@ describe('render', function() describe('resolve_provider', function() before_each(function() - vim.g.render = { + helpers.reset_config({ providers = { typst = { cmd = { 'typst', 'compile' } }, }, providers_by_ft = { typst = 'typst', }, - } - helpers.reset_config() + }) render = require('render') end) @@ -80,11 +75,10 @@ describe('render', function() end) it('returns nil when provider name maps to missing config', function() - vim.g.render = { + helpers.reset_config({ providers = {}, providers_by_ft = { typst = 'typst' }, - } - helpers.reset_config() + }) local bufnr = helpers.create_buffer({}, 'typst') local name = require('render').resolve_provider(bufnr) assert.is_nil(name)