From 738a81ec729418a7029e099bff91c255606ab59f Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Mon, 20 May 2024 11:22:23 +0200 Subject: [PATCH] Deactivate some tests for neovim v0.10 The default colorscheme in neovim was changed in https://github.com/neovim/neovim/pull/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. --- .github/workflows/test.yml | 24 ++++++++++++--------- flake.nix | 8 +++++-- test/nvimpager_spec.lua | 44 +++++++++++++++++++------------------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 534cb1c..494c4a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ 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 @@ -30,10 +30,13 @@ jobs: 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 @@ -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: @@ -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 @@ -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 @@ -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 }}' diff --git a/flake.nix b/flake.nix index b9b2b47..7f6c332 100644 --- a/flake.nix +++ b/flake.nix @@ -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 }: @@ -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}') ''; @@ -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"; }))); diff --git a/test/nvimpager_spec.lua b/test/nvimpager_spec.lua index 59a1514..25e2b09 100644 --- a/test/nvimpager_spec.lua +++ b/test/nvimpager_spec.lua @@ -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") @@ -94,14 +94,14 @@ 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") .. @@ -109,7 +109,7 @@ describe("cat mode", function() 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") @@ -130,7 +130,7 @@ 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" .. @@ -138,19 +138,19 @@ describe("cat mode", function() 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 @@ -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'\"") @@ -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'\"") @@ -186,20 +186,20 @@ 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") @@ -207,7 +207,7 @@ describe("cat mode", function() 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.."'") @@ -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'\" ".. @@ -233,13 +233,13 @@ 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") @@ -247,12 +247,12 @@ describe("cat mode", function() 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) @@ -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") @@ -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")