Skip to content

Commit

Permalink
Deactivate some tests for neovim v0.10
Browse files Browse the repository at this point in the history
The default colorscheme in neovim was changed in
neovim/neovim#26334 and that breaks some of our
tests.  Until I figure out a way to fix these tests for both neovim v0.9
and v0.10 or until I formally deprecate 0.9 support the problematic
tests are deactivated for neovim 0.10.
  • Loading branch information
lucc committed May 20, 2024
1 parent 9e557e5 commit 738a81e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 34 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ jobs:
sudo apt-get update
sudo apt-get install -yqq --no-install-recommends neovim scdoc lua-busted
- name: Run the test suite
run: make test BUSTED='busted --exclude-tags=ppa'
run: make test BUSTED='busted --exclude-tags=ppa,v10'
env:
TERM: dumb

appimage:
runs-on: ubuntu-latest
strategy:
matrix:
appimage-version:
- v0.9.0
- v0.10.0
- nightly
x:
- version: v0.9.0
tags: [appimage]
- version: v0.10.0
tags: [appimage, v10]
- version: nightly
tags: [appimage, v10]
steps:
- uses: actions/checkout@v3
- name: install dependencies
Expand All @@ -42,16 +45,17 @@ jobs:
sudo apt-get install -yqq --no-install-recommends scdoc lua-busted
- name: Download official neovim appimage
run: |
wget https://github.com/neovim/neovim/releases/download/${{ matrix.appimage-version }}/nvim.appimage{,.sha256sum}
wget https://github.com/neovim/neovim/releases/download/${{ matrix.x.version }}/nvim.appimage{,.sha256sum}
sha256sum -c nvim.appimage.sha256sum
chmod +x nvim.appimage
./nvim.appimage --appimage-extract
- name: Run the test suite
run: make test BUSTED='busted --exclude-tags=appimage'
run: make test "BUSTED=busted --exclude-tags=${{ join(matrix.x.tags, ',') }}"
env:
TERM: dumb
NVIMPAGER_NVIM: squashfs-root/usr/bin/nvim


macos:
runs-on: macos-latest
steps:
Expand All @@ -62,7 +66,7 @@ jobs:
brew install neovim scdoc luarocks
luarocks --local install busted
- name: Run the test suite
run: make test BUSTED="$HOME/.luarocks/bin/busted --exclude-tags=mac"
run: make test BUSTED="$HOME/.luarocks/bin/busted --exclude-tags=mac,v10"
env:
TERM: dumb

Expand All @@ -76,7 +80,7 @@ jobs:
name: nix-community
- uses: actions/checkout@v3
- name: Run the test suite via nix
run: nix build --print-build-logs
run: nix build --print-build-logs

nix:
runs-on: ubuntu-latest
Expand All @@ -102,4 +106,4 @@ jobs:
run: nix flake update
if: matrix.update
- name: Run the test suite with ${{ matrix.package }} neovim
run: nix build --print-build-logs '.#${{ matrix.package }}'
run: nix build --print-build-logs '.#${{ matrix.package }}'
8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
inherit (flake-utils.lib) eachDefaultSystem;
version = head (match ".*version=([0-9.]*)\n.*" (readFile ./nvimpager))
+ "-dev-${toString self.sourceInfo.lastModifiedDate}";
inherit (nixpkgs.lib.strings) optionalString;
nvimpager = {
stdenv, neovim, ncurses, procps, scdoc, lua51Packages, util-linux
}:
Expand All @@ -38,7 +39,10 @@
nativeCheckInputs = [ lua51Packages.busted util-linux neovim ];
# filter out one test that fails in the sandbox of nix
preCheck = let
exclude-tags = if stdenv.isDarwin then "nix,mac" else "nix";
neovim-version = neovim.version or neovim.passthru.unwrapped.version;
neovim-new = null == match "^0\\.9\\..*" neovim-version;
exclude-tags = "nix" + optionalString stdenv.isDarwin ",mac"
+ optionalString neovim-new ",v10";
in ''
checkFlagsArray+=('BUSTED=busted --output TAP --exclude-tags=${exclude-tags}')
'';
Expand All @@ -56,7 +60,7 @@
nightly = callPackage { neovim = neovim-nightly; };
in {
apps.default = flake-utils.lib.mkApp { drv = default; };
packages = { inherit default nightly; };
packages = { inherit default nightly neovim-nightly; inherit (pkgs) neovim; };
packages.ldoc = pkgs.runCommandLocal "nvimpager-api-docs" {}
"cd ${self} && ${pkgs.luaPackages.ldoc}/bin/ldoc . --dir $out";
})));
Expand Down
44 changes: 22 additions & 22 deletions test/nvimpager_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ describe("cat mode", function()
end)
end)

it("displays a small file with syntax highlighting to stdout", function()
it("displays a small file with syntax highlighting to stdout #v10", function()
local output = run("./nvimpager -c test/fixtures/makefile")
local expected = read("test/fixtures/makefile.ansi")
assert.equal(expected, output)
end)

it("reads stdin with syntax highlighting", function()
it("reads stdin with syntax highlighting #v10", function()
local output = run("./nvimpager -c -- " ..
"-c 'set filetype=make' " ..
"< test/fixtures/makefile")
Expand All @@ -94,22 +94,22 @@ describe("cat mode", function()
assert.equal(expected, output)
end)

it("handles color schemes with a non trivial Normal group", function()
it("handles color schemes with a non trivial Normal group #v10", function()
local output = run("./nvimpager -c test/fixtures/conceal.tex " ..
"--cmd 'hi Normal ctermfg=Red'")
local expected = read("test/fixtures/conceal.tex.red")
assert.equal(expected, output)
end)

it("highlights all files", function()
it("highlights all files #v10", function()
local output = run("./nvimpager -c test/fixtures/makefile " ..
"test/fixtures/help.txt ")
local expected = read("test/fixtures/makefile.ansi") ..
read("test/fixtures/help.txt.ansi")
assert.equal(expected, output)
end)

it("concatenates the same file twice", function()
it("concatenates the same file twice #v10", function()
local output = run("./nvimpager -c test/fixtures/makefile " ..
"test/fixtures/makefile ")
local expected = read("test/fixtures/makefile.ansi")
Expand All @@ -130,27 +130,27 @@ describe("cat mode", function()
assert.equal('', output)
end)

it("explicit - as file argument means stdin", function()
it("explicit - as file argument means stdin #v10", function()
local shell_command = "echo foo | ./nvimpager -c - test/fixtures/makefile"
local output = run("sh -c '" .. shell_command .. "'")
local expected = "\27[0mfoo\27[0m\n" ..
read("test/fixtures/makefile.ansi")
assert.equal(expected, output)
end)

it("prefers file arguments over stdin", function()
it("prefers file arguments over stdin #v10", function()
local shell_command = "echo foo | ./nvimpager -c test/fixtures/makefile"
local output = run("sh -c '" .. shell_command .. "'")
assert.equal(read("test/fixtures/makefile.ansi"), output)
end)

it("can show stdin as the second file", function()
it("can show stdin as the second file #v10", function()
local output = run("echo foo | ./nvimpager -c test/fixtures/makefile -")
local expected = read("test/fixtures/makefile.ansi") .. "\27[0mfoo\27[0m\n"
assert.equal(expected, output)
end)

describe("can change the default foreground color", function()
describe("can change the default foreground color #v10", function()
for termguicolors, extension in pairs({termguicolors = "red24", notermguicolors = "red"}) do
for _, command in pairs({"--cmd", "-c"}) do
for stdin, redirect in pairs({[false] = "", [true] = "<"}) do
Expand All @@ -168,7 +168,7 @@ describe("cat mode", function()
end)

describe("with modeline", function()
it("highlights files even after mode line files", function()
it("highlights files even after mode line files #v10", function()
local output = run("./nvimpager -c test/fixtures/conceal.tex " ..
"test/fixtures/makefile " ..
"--cmd \"let g:tex_flavor='latex'\"")
Expand All @@ -177,7 +177,7 @@ describe("cat mode", function()
assert.equal(expected, output)
end)

it("honors mode lines in later files", function()
it("honors mode lines in later files #v10", function()
local output = run("./nvimpager -c test/fixtures/makefile " ..
"test/fixtures/conceal.tex " ..
"--cmd \"let g:tex_flavor='latex'\"")
Expand All @@ -186,28 +186,28 @@ describe("cat mode", function()
assert.equal(expected, output)
end)

it("ignores mode lines in diffs", function()
it("ignores mode lines in diffs #v10", function()
local output = run("./nvimpager -c test/fixtures/diff-modeline 2>&1")
local expected = read("test/fixtures/diff-modeline.ansi")
assert.equal(expected, output)
end)

it("ignores mode lines in git diffs", function()
it("ignores mode lines in git diffs #v10", function()
local output = run("test/fixtures/bin/git ./nvimpager -c " ..
"test/fixtures/diff-modeline 2>&1")
local expected = read("test/fixtures/diff-modeline.ansi")
assert.equal(expected, output)
end)

it("ignores mode lines in git log diffs #mac", function()
it("ignores mode lines in git log diffs #mac #v10", function()
local output = run("test/fixtures/bin/git ./nvimpager -c " ..
"test/fixtures/git-log 2>&1")
local expected = read("test/fixtures/git-log.ansi")
assert.equal(expected, output)
end)
end)

describe("conceals", function()
describe("conceals #v10", function()
local function test_level(level)
local output = run("./nvimpager -c test/fixtures/help.txt " ..
"-c 'set cole="..level.."'")
Expand All @@ -219,7 +219,7 @@ describe("cat mode", function()
it("are highlighted at conceallevel=0", function() test_level(0) end)
end)

describe("conceal replacements", function()
describe("conceal replacements #v10", function()
local function test_replace(level)
local output = run("./nvimpager -c test/fixtures/conceal.tex "..
"--cmd \"let g:tex_flavor='latex'\" "..
Expand All @@ -233,26 +233,26 @@ describe("cat mode", function()
end)

describe("listchars", function()
it("handle spaces, trailing spaces and eol with termguicolors", function()
it("handle spaces, trailing spaces and eol with termguicolors #v10", function()
local output = run("./nvimpager -c test/fixtures/listchars1.txt " ..
"--cmd 'se tgc list lcs+=space:_,eol:$'")
local expected = read("test/fixtures/listchars1.txt.24bit")
assert.equal(expected, output)
end)
it("handle spaces, trailing spaces and eol with 256 colors", function()
it("handle spaces, trailing spaces and eol with 256 colors #v10", function()
local output = run("./nvimpager -c test/fixtures/listchars1.txt " ..
"--cmd 'se list lcs+=space:_,eol:$'")
local expected = read("test/fixtures/listchars1.txt.8bit")
assert.equal(expected, output)
end)
describe("handles non breaking spaces", function()
local expected = read("test/fixtures/nbsp.ansi")
it("in utf8 files", function()
it("in utf8 files #v10", function()
local output = run("./nvimpager -c test/fixtures/nbsp.utf8.txt " ..
"--cmd 'se list'")
assert.equal(expected, output)
end)
it("in latin1 files", function()
it("in latin1 files #v10", function()
local output = run("./nvimpager -c test/fixtures/nbsp.latin1.txt " ..
"--cmd 'se list'")
assert.equal(expected, output)
Expand Down Expand Up @@ -303,7 +303,7 @@ describe("parent detection", function()
assert.equal("man", output)
end)

it("handles git", function()
it("handles git #v10", function()
local output = run("test/fixtures/bin/git ./nvimpager -c " ..
"test/fixtures/diff")
local expected = read("test/fixtures/diff.ansi")
Expand All @@ -317,7 +317,7 @@ describe("parent detection", function()
assert.equal(expected, output)
end)

it("handles man #mac #nix", function()
it("handles man #mac #nix #v10", function()
local output = run("test/fixtures/bin/man ./nvimpager -c " ..
"test/fixtures/man.cat")
local expected = read("test/fixtures/man.ansi")
Expand Down

0 comments on commit 738a81e

Please sign in to comment.