diff --git a/.github/actions/test-setup/action.yml b/.github/actions/test-setup/action.yml
new file mode 100644
index 0000000..2435fe0
--- /dev/null
+++ b/.github/actions/test-setup/action.yml
@@ -0,0 +1,18 @@
+name: Test Setup
+description: Install Neovim, Lua 5.1, Luarocks, busted, nlua, and guard.nvim
+
+runs:
+ using: composite
+ steps:
+ - uses: rhysd/action-setup-vim@v1
+ with:
+ neovim: true
+ version: nightly
+ - uses: leso-kn/gh-actions-lua@master
+ with:
+ luaVersion: '5.1'
+ - uses: hishamhm/gh-actions-luarocks@master
+ - run: luarocks install busted --local && luarocks install nlua --local
+ shell: bash
+ - run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
+ shell: bash
diff --git a/.github/scripts/install-binary-tools.sh b/.github/scripts/install-binary-tools.sh
index 3578406..648afb8 100755
--- a/.github/scripts/install-binary-tools.sh
+++ b/.github/scripts/install-binary-tools.sh
@@ -30,9 +30,14 @@ while read -r name type url extra; do
chmod +x "$dest/$name"
rm -rf "$tmpdir"
;;
+ gz)
+ wget -q "$url" -O "$dest/$name.gz"
+ gunzip "$dest/$name.gz"
+ chmod +x "$dest/$name"
+ ;;
jar)
wget -q "$url" -O "$dest/$name.jar"
- printf '#!/usr/bin/env bash\nexec java -jar "%s/%s.jar" "$@"\n' "$(cd "$dest" && pwd)" "$name" > "$dest/$name"
+ printf '#!/bin/sh\njava -jar %s/%s.jar "$@"\n' "$dest" "$name" > "$dest/$name"
chmod +x "$dest/$name"
;;
esac
diff --git a/.github/tools/binary-apt.txt b/.github/tools/binary-apt.txt
new file mode 100644
index 0000000..2781657
--- /dev/null
+++ b/.github/tools/binary-apt.txt
@@ -0,0 +1,6 @@
+fish
+jq
+libxml2-utils
+pgformatter
+shellcheck
+zsh
diff --git a/.github/tools/binary.txt b/.github/tools/binary.txt
index 5dcdab5..786b125 100644
--- a/.github/tools/binary.txt
+++ b/.github/tools/binary.txt
@@ -1,12 +1,20 @@
alejandra bin https://github.com/kamadorueda/alejandra/releases/download/4.0.0/alejandra-x86_64-unknown-linux-musl
buf bin https://github.com/bufbuild/buf/releases/download/v1.47.2/buf-Linux-x86_64
-hadolint bin https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
+cbfmt tar https://github.com/lukas-reineke/cbfmt/releases/download/v0.2.0/cbfmt_linux-x86_64_v0.2.0.tar.gz cbfmt_linux-x86_64_v0.2.0/cbfmt
checkmake bin https://github.com/mrtazz/checkmake/releases/download/0.2.2/checkmake-0.2.2.linux.amd64
+cljfmt tar https://github.com/weavejester/cljfmt/releases/download/0.15.6/cljfmt-0.15.6-linux-amd64-static.tar.gz cljfmt
deno zip https://github.com/denoland/deno/releases/download/v2.1.4/deno-x86_64-unknown-linux-gnu.zip
detekt jar https://github.com/detekt/detekt/releases/download/v1.23.7/detekt-cli-1.23.7-all.jar
+dprint zip https://github.com/dprint/dprint/releases/download/0.49.0/dprint-x86_64-unknown-linux-gnu.zip
+google-java-format jar https://github.com/google/google-java-format/releases/download/v1.34.1/google-java-format-1.34.1-all-deps.jar
+hadolint bin https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
hlint tar https://github.com/ndmitchell/hlint/releases/download/v3.10/hlint-3.10-x86_64-linux.tar.gz hlint-3.10/hlint
+ktfmt jar https://repo1.maven.org/maven2/com/facebook/ktfmt/0.52/ktfmt-0.52-jar-with-dependencies.jar
+ktlint bin https://github.com/pinterest/ktlint/releases/download/1.8.0/ktlint
latexindent bin https://github.com/cmhughes/latexindent.pl/releases/download/V3.24.4/latexindent-linux
+ormolu zip https://github.com/tweag/ormolu/releases/download/0.8.0.2/ormolu-x86_64-linux.zip
+shfmt bin https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_amd64
swiftformat zip https://github.com/nicklockwood/SwiftFormat/releases/download/0.55.3/swiftformat_linux.zip swiftformat_linux
-cbfmt tar https://github.com/lukas-reineke/cbfmt/releases/download/v0.2.0/cbfmt_linux-x86_64_v0.2.0.tar.gz cbfmt_linux-x86_64_v0.2.0/cbfmt
-dprint zip https://github.com/dprint/dprint/releases/download/0.49.0/dprint-x86_64-unknown-linux-gnu.zip
-ktlint bin https://github.com/pinterest/ktlint/releases/download/1.8.0/ktlint
+tombi gz https://github.com/tombi-toml/tombi/releases/download/v0.7.27/tombi-cli-0.7.27-x86_64-unknown-linux-musl.gz
+typos tar https://github.com/crate-ci/typos/releases/download/v1.43.3/typos-v1.43.3-x86_64-unknown-linux-musl.tar.gz ./typos
+typstyle bin https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-x86_64-unknown-linux-gnu
diff --git a/.github/tools/go.txt b/.github/tools/go.txt
index faff64e..195c94e 100644
--- a/.github/tools/go.txt
+++ b/.github/tools/go.txt
@@ -1,2 +1,4 @@
+golang.org/x/tools/cmd/goimports@latest
mvdan.cc/gofumpt@latest
github.com/segmentio/golines@latest
+github.com/google/yamlfmt/cmd/yamlfmt@latest
diff --git a/.github/tools/npm.txt b/.github/tools/npm.txt
index f690d5f..d9871ec 100644
--- a/.github/tools/npm.txt
+++ b/.github/tools/npm.txt
@@ -1,4 +1,5 @@
prettier
+@fsouza/prettierd
@biomejs/biome
sql-formatter
@taplo/cli
diff --git a/.github/tools/pip.txt b/.github/tools/pip.txt
index 1be75bd..711c5a0 100644
--- a/.github/tools/pip.txt
+++ b/.github/tools/pip.txt
@@ -1,11 +1,16 @@
autopep8
black
cmake-format
+codespell
cpplint
+djhtml
docformatter
flake8
+isort
+mdformat
mypy
pylint
ruff
sqlfluff
+yamlfix
yapf
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e181a68..7b4364e 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -21,24 +21,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
+ - uses: ./.github/actions/test-setup
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- name: Install tools
- run: |
- pip install -q -r .github/tools/pip.txt
- luarocks install busted --local
- luarocks install nlua --local
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
+ run: pip install -q -r .github/tools/pip.txt
- name: Run tests
run: |
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -48,24 +36,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
+ - uses: ./.github/actions/test-setup
- uses: actions/setup-node@v4
with:
node-version: 20
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- name: Install tools
- run: |
- xargs npm install -g < .github/tools/npm.txt
- luarocks install busted --local
- luarocks install nlua --local
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
+ run: xargs npm install -g < .github/tools/npm.txt
- name: Run tests
run: |
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -75,26 +51,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
+ - uses: ./.github/actions/test-setup
- uses: actions/setup-go@v5
with:
go-version: stable
cache: false
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- name: Install tools
run: |
xargs -L1 go install < .github/tools/go.txt
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8
- luarocks install busted --local
- luarocks install nlua --local
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
- name: Run tests
run: |
export PATH="$HOME/go/bin:$PATH"
@@ -105,26 +70,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
+ - uses: ./.github/actions/test-setup
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- - name: Install test tools
- run: |
- luarocks install busted --local
- luarocks install nlua --local
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
- name: Run tests
run: |
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -134,22 +86,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
+ - uses: ./.github/actions/test-setup
- name: Install tools
run: |
- luarocks install busted --local
- luarocks install nlua --local
luarocks install luacheck --local
+ luarocks install fnlfmt --local
bash .github/scripts/install-binary-tools.sh "$HOME/.local/bin" .github/tools/lua-binary.txt
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
- name: Run tests
run: |
export PATH="$HOME/.local/bin:$PATH"
@@ -160,26 +102,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
+ - uses: ./.github/actions/test-setup
+ - uses: dart-lang/setup-dart@v1
+ - uses: mlugg/setup-zig@v2
with:
- neovim: true
- version: nightly
+ version: 0.15.2
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- name: Install tools
run: |
- sudo apt-get install -y zsh shellcheck
- luarocks install busted --local
- luarocks install nlua --local
+ xargs sudo apt-get install -y < .github/tools/binary-apt.txt
bash .github/scripts/install-binary-tools.sh "$HOME/.local/bin"
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
- name: Run tests
run: |
export PATH="$HOME/.local/bin:$PATH"
@@ -190,21 +125,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
+ - uses: ./.github/actions/test-setup
- name: Install tools
- run: |
- xargs sudo apt-get install -y < .github/tools/apt.txt
- luarocks install busted --local
- luarocks install nlua --local
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
+ run: xargs sudo apt-get install -y < .github/tools/apt.txt
- name: Run tests
run: |
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -214,24 +137,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
+ - uses: ./.github/actions/test-setup
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- name: Install tools
- run: |
- dotnet tool install -g csharpier
- luarocks install busted --local
- luarocks install nlua --local
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
+ run: dotnet tool install -g csharpier
- name: Run tests
run: |
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -241,31 +152,53 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: rhysd/action-setup-vim@v1
- with:
- neovim: true
- version: nightly
+ - uses: ./.github/actions/test-setup
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- - uses: leso-kn/gh-actions-lua@master
- with:
- luaVersion: "5.1"
- - uses: hishamhm/gh-actions-luarocks@master
- name: Install tools
+ run: gem install rubocop
+ - name: Run tests
run: |
- gem install rubocop bundler
- luarocks install busted --local
- luarocks install nlua --local
- - name: Setup rubocop Gemfile
+ export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
+ busted --lua nlua test/ruby/*_spec.lua
+
+ test-elixir:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/test-setup
+ - uses: erlef/setup-beam@v1
+ with:
+ otp-version: '27'
+ elixir-version: '1.17'
+ - name: Run tests
run: |
- mkdir -p /tmp/rubocop-test
- printf "source 'https://rubygems.org'\ngem 'rubocop'\n" > /tmp/rubocop-test/Gemfile
- cd /tmp/rubocop-test && bundle install
- - name: Clone guard.nvim
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
+ export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
+ busted --lua nlua test/elixir/*_spec.lua
+
+ test-nix:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/test-setup
+ - uses: cachix/install-nix-action@v27
+ - name: Install tools
+ run: nix profile install nixpkgs#nixfmt-rfc-style
- name: Run tests
run: |
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
- busted --lua nlua test/ruby/*_spec.lua
+ busted --lua nlua test/nix/*_spec.lua
+ test-swift:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/test-setup
+ - uses: swift-actions/setup-swift@v2
+ with:
+ swift-version: '6.0'
+ - name: Run tests
+ run: |
+ export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
+ busted --lua nlua test/swift/*_spec.lua
diff --git a/Makefile b/Makefile
index d8a9073..3f00966 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
LUA_PATH := lua/?.lua;lua/?/init.lua;$(LUA_PATH)
export LUA_PATH
-.PHONY: lint test test-pip test-npm test-go test-rust test-lua test-binary test-apt
+.PHONY: lint test test-pip test-npm test-go test-rust test-lua test-binary test-apt test-dotnet test-ruby test-elixir test-nix test-swift
lint:
stylua --check .
-test: test-pip test-npm test-go test-rust test-lua test-binary test-apt
+test: test-pip test-npm test-go test-rust test-lua test-binary test-apt test-dotnet test-ruby test-elixir test-nix test-swift
test-pip:
busted --lua nlua test/pip/*_spec.lua
@@ -29,3 +29,17 @@ test-binary:
test-apt:
busted --lua nlua test/apt/*_spec.lua
+test-dotnet:
+ busted --lua nlua test/dotnet/*_spec.lua
+
+test-ruby:
+ busted --lua nlua test/ruby/*_spec.lua
+
+test-elixir:
+ busted --lua nlua test/elixir/*_spec.lua
+
+test-nix:
+ busted --lua nlua test/nix/*_spec.lua
+
+test-swift:
+ busted --lua nlua test/swift/*_spec.lua
diff --git a/lua/guard-collection/formatter.lua b/lua/guard-collection/formatter.lua
index 6bffdf5..ff61fe8 100644
--- a/lua/guard-collection/formatter.lua
+++ b/lua/guard-collection/formatter.lua
@@ -212,8 +212,8 @@ M.prettierd = {
}
M.rubocop = {
- cmd = 'bundle',
- args = { 'exec', 'rubocop', '-A', '-f', 'quiet', '--stderr', '--stdin' },
+ cmd = 'rubocop',
+ args = { '-A', '-f', 'quiet', '--stderr', '--stdin' },
stdin = true,
fname = true,
}
diff --git a/lua/guard-collection/linter/rubocop.lua b/lua/guard-collection/linter/rubocop.lua
index 732d8c5..38e67eb 100644
--- a/lua/guard-collection/linter/rubocop.lua
+++ b/lua/guard-collection/linter/rubocop.lua
@@ -1,8 +1,8 @@
local lint = require('guard.lint')
return {
- cmd = 'bundle',
- args = { 'exec', 'rubocop', '--format', 'json', '--force-exclusion', '--stdin' },
+ cmd = 'rubocop',
+ args = { '--format', 'json', '--force-exclusion', '--stdin' },
stdin = true,
fname = true,
parse = lint.from_json({
diff --git a/test/binary/buf_spec.lua b/test/binary/buf_spec.lua
index 7040439..47b6066 100644
--- a/test/binary/buf_spec.lua
+++ b/test/binary/buf_spec.lua
@@ -17,4 +17,22 @@ describe('buf', function()
}, { tmpdir = tmpdir })
assert.is_true(#formatted > 3)
end)
+
+ it('can lint', function()
+ local helper = require('test.helper')
+ vim.fn.writefile({ 'version: v2' }, tmpdir .. '/buf.yaml')
+ local bufnr, diagnostics = helper.run_lint('buf', 'proto', {
+ 'syntax = "proto3";',
+ 'message Foo {',
+ ' string bar = 1;',
+ '}',
+ }, { cwd = tmpdir, tmpdir = tmpdir })
+ assert.is_true(#diagnostics > 0)
+ for _, d in ipairs(diagnostics) do
+ assert.equal(bufnr, d.bufnr)
+ assert.equal('buf', d.source)
+ assert.is_number(d.lnum)
+ assert.is_string(d.message)
+ end
+ end)
end)
diff --git a/test/binary/cljfmt_spec.lua b/test/binary/cljfmt_spec.lua
new file mode 100644
index 0000000..f333606
--- /dev/null
+++ b/test/binary/cljfmt_spec.lua
@@ -0,0 +1,11 @@
+describe('cljfmt', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('cljfmt', 'clj', {
+ [[(defn hello]],
+ [[ [name] (println "hello"]],
+ [[name))]],
+ })
+ assert.is_true(#formatted > 0)
+ assert.is_true(formatted[1]:find('defn hello') ~= nil)
+ end)
+end)
diff --git a/test/binary/dart_spec.lua b/test/binary/dart_spec.lua
new file mode 100644
index 0000000..c209797
--- /dev/null
+++ b/test/binary/dart_spec.lua
@@ -0,0 +1,9 @@
+describe('dart', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('dart', 'dart', {
+ [[void main(){print('hello');}]],
+ })
+ assert.is_true(#formatted > 1)
+ assert.is_true(formatted[1]:find('void main') ~= nil)
+ end)
+end)
diff --git a/test/binary/fish_indent_spec.lua b/test/binary/fish_indent_spec.lua
new file mode 100644
index 0000000..f2ea7ee
--- /dev/null
+++ b/test/binary/fish_indent_spec.lua
@@ -0,0 +1,14 @@
+describe('fish_indent', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('fish_indent', 'fish', {
+ [[if test "$x" = "y"]],
+ [[echo hello]],
+ [[end]],
+ })
+ assert.are.same({
+ [[if test "$x" = y]],
+ [[ echo hello]],
+ [[end]],
+ }, formatted)
+ end)
+end)
diff --git a/test/binary/google-java-format_spec.lua b/test/binary/google-java-format_spec.lua
new file mode 100644
index 0000000..38fb99f
--- /dev/null
+++ b/test/binary/google-java-format_spec.lua
@@ -0,0 +1,9 @@
+describe('google-java-format', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('google-java-format', 'java', {
+ 'class A{void m(){int x=1;}}',
+ })
+ assert.is_true(#formatted > 1)
+ assert.is_true(formatted[1]:find('class A') ~= nil)
+ end)
+end)
diff --git a/test/binary/jq_spec.lua b/test/binary/jq_spec.lua
new file mode 100644
index 0000000..9612a1b
--- /dev/null
+++ b/test/binary/jq_spec.lua
@@ -0,0 +1,13 @@
+describe('jq', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('jq', 'json', {
+ [[{"b":2,"a":1}]],
+ })
+ assert.are.same({
+ [[{]],
+ [[ "b": 2,]],
+ [[ "a": 1]],
+ [[}]],
+ }, formatted)
+ end)
+end)
diff --git a/test/binary/ktfmt_spec.lua b/test/binary/ktfmt_spec.lua
new file mode 100644
index 0000000..f249720
--- /dev/null
+++ b/test/binary/ktfmt_spec.lua
@@ -0,0 +1,9 @@
+describe('ktfmt', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('ktfmt', 'kt', {
+ [[fun main(){val x=1;println(x)}]],
+ })
+ assert.is_true(#formatted > 1)
+ assert.is_true(formatted[1]:find('fun main') ~= nil)
+ end)
+end)
diff --git a/test/binary/ormolu_spec.lua b/test/binary/ormolu_spec.lua
new file mode 100644
index 0000000..52edf0a
--- /dev/null
+++ b/test/binary/ormolu_spec.lua
@@ -0,0 +1,13 @@
+describe('ormolu', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('ormolu', 'hs', {
+ [[module Main where]],
+ [[main = putStrLn "hello"]],
+ })
+ assert.are.same({
+ [[module Main where]],
+ [[]],
+ [[main = putStrLn "hello"]],
+ }, formatted)
+ end)
+end)
diff --git a/test/binary/pg_format_spec.lua b/test/binary/pg_format_spec.lua
new file mode 100644
index 0000000..3e44720
--- /dev/null
+++ b/test/binary/pg_format_spec.lua
@@ -0,0 +1,9 @@
+describe('pg_format', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('pg_format', 'sql', {
+ [[select id, name from users where id = 1;]],
+ })
+ assert.is_true(#formatted > 1)
+ assert.is_truthy(formatted[1]:match('SELECT'))
+ end)
+end)
diff --git a/test/binary/shfmt_spec.lua b/test/binary/shfmt_spec.lua
new file mode 100644
index 0000000..e6c3a20
--- /dev/null
+++ b/test/binary/shfmt_spec.lua
@@ -0,0 +1,16 @@
+describe('shfmt', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('shfmt', 'sh', {
+ [[#!/bin/sh]],
+ [[if [ "$x" = "y" ]; then]],
+ [[echo "hello"]],
+ [[fi]],
+ })
+ assert.are.same({
+ [[#!/bin/sh]],
+ [[if [ "$x" = "y" ]; then]],
+ '\techo "hello"',
+ [[fi]],
+ }, formatted)
+ end)
+end)
diff --git a/test/binary/tombi_spec.lua b/test/binary/tombi_spec.lua
new file mode 100644
index 0000000..8808fef
--- /dev/null
+++ b/test/binary/tombi_spec.lua
@@ -0,0 +1,16 @@
+describe('tombi', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('tombi', 'toml', {
+ '[package]',
+ 'name="test"',
+ 'version = "0.1.0"',
+ })
+ assert.is_true(#formatted > 0)
+ for _, line in ipairs(formatted) do
+ if line:find('name') then
+ assert.is_true(line:find('name = ') ~= nil)
+ break
+ end
+ end
+ end)
+end)
diff --git a/test/binary/typos_spec.lua b/test/binary/typos_spec.lua
new file mode 100644
index 0000000..a942017
--- /dev/null
+++ b/test/binary/typos_spec.lua
@@ -0,0 +1,14 @@
+describe('typos', function()
+ it('can lint', function()
+ local helper = require('test.helper')
+ local buf, diagnostics = helper.run_lint('typos', 'txt', {
+ [[teh quick brown fox]],
+ })
+ assert.is_true(#diagnostics > 0)
+ for _, d in ipairs(diagnostics) do
+ assert.equal(buf, d.bufnr)
+ assert.is_number(d.lnum)
+ assert.is_string(d.message)
+ end
+ end)
+end)
diff --git a/test/binary/typstyle_spec.lua b/test/binary/typstyle_spec.lua
new file mode 100644
index 0000000..7169c4f
--- /dev/null
+++ b/test/binary/typstyle_spec.lua
@@ -0,0 +1,10 @@
+describe('typstyle', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('typstyle', 'typ', {
+ [[#let x = 1]],
+ })
+ assert.are.same({
+ [[#let x = 1]],
+ }, formatted)
+ end)
+end)
diff --git a/test/binary/xmllint_spec.lua b/test/binary/xmllint_spec.lua
new file mode 100644
index 0000000..5c1f3fd
--- /dev/null
+++ b/test/binary/xmllint_spec.lua
@@ -0,0 +1,13 @@
+describe('xmllint', function()
+ it('can format', function()
+ local formatted = require('test.helper').run_fmt('xmllint', 'xml', {
+ [[
hello
]], + [[hello
]], + [[