lucc / nvimpager

Use nvim as a pager to view manpages, diffs, etc with nvim's syntax highlighting
Other
386 stars 20 forks source link

broken tests on neovim 0.10.0 #99

Open KiaraGrouwstra opened 4 months ago

KiaraGrouwstra commented 4 months ago

on nixos this package went from green to red as per git bisect on a neovim update from 0.9.5 to 0.10.0. it would be nice to see nvimpager account for this update.

test failing on this update: ``` ok 1 - auto mode selects cat mode for small files ok 2 - auto mode auto mode selects pager mode for big inputs not ok 3 - cat mode displays a small file with syntax highlighting to stdout # test/nvimpager_spec.lua @ 56 # Failure message: test/nvimpager_spec.lua:59: Expected objects to be equal. # Passed in: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' # Expected: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' not ok 4 - cat mode reads stdin with syntax highlighting # test/nvimpager_spec.lua @ 62 # Failure message: test/nvimpager_spec.lua:67: Expected objects to be equal. # Passed in: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' # Expected: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' ok 5 - cat mode returns ansi escape sequences unchanged not ok 6 - cat mode handles color schemes with a non trivial Normal group # test/nvimpager_spec.lua @ 76 # Failure message: test/nvimpager_spec.lua:80: Expected objects to be equal. # Passed in: # (string) '\ss should be ß # ' # Expected: # (string) '\ss should be ß # ' not ok 7 - cat mode highlights all files # test/nvimpager_spec.lua @ 83 # Failure message: test/nvimpager_spec.lua:88: Expected objects to be equal. # Passed in: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # *conceal-test* normal # conceal-test # vim: filetype=help # ' # Expected: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # conceal-test normal # conceal-test # vim: filetype=help # ' not ok 8 - cat mode concatenates the same file twice # test/nvimpager_spec.lua @ 91 # Failure message: test/nvimpager_spec.lua:96: Expected objects to be equal. # Passed in: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # # a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' # Expected: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # # a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' not ok 9 - cat mode produces no output for empty files # test/nvimpager_spec.lua @ 99 # Failure message: test/nvimpager_spec.lua:104: Expected objects to be equal. # Passed in: # (string) ' # ' # Expected: # (string) '' not ok 10 - cat mode produces no output for empty stdin # test/nvimpager_spec.lua @ 107 # Failure message: test/nvimpager_spec.lua:109: Expected objects to be equal. # Passed in: # (string) ' # ' # Expected: # (string) '' not ok 11 - cat mode explicit - as file argument means stdin # test/nvimpager_spec.lua @ 112 # Failure message: test/nvimpager_spec.lua:117: Expected objects to be equal. # Passed in: # (string) 'foo # # a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' # Expected: # (string) 'foo # # a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' not ok 12 - cat mode prefers file arguments over stdin # test/nvimpager_spec.lua @ 120 # Failure message: test/nvimpager_spec.lua:123: Expected objects to be equal. # Passed in: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' # Expected: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' not ok 13 - cat mode can change the default foreground color with --cmd, setting termguicolors # test/nvimpager_spec.lua @ 130 # Failure message: test/nvimpager_spec.lua:136: Expected objects to be equal. # Passed in: # (string) ' # some text # ' # Expected: # (string) 'some text # ' not ok 14 - cat mode can change the default foreground color with --cmd, setting termguicolors input via stdin # test/nvimpager_spec.lua @ 130 # Failure message: test/nvimpager_spec.lua:136: Expected objects to be equal. # Passed in: # (string) 'some text # ' # Expected: # (string) 'some text # ' not ok 15 - cat mode can change the default foreground color with -c, setting termguicolors # test/nvimpager_spec.lua @ 130 # Failure message: test/nvimpager_spec.lua:136: Expected objects to be equal. # Passed in: # (string) ' # some text # ' # Expected: # (string) 'some text # ' not ok 16 - cat mode can change the default foreground color with -c, setting termguicolors input via stdin # test/nvimpager_spec.lua @ 130 # Failure message: test/nvimpager_spec.lua:136: Expected objects to be equal. # Passed in: # (string) 'some text # ' # Expected: # (string) 'some text # ' not ok 17 - cat mode can change the default foreground color with --cmd, setting notermguicolors # test/nvimpager_spec.lua @ 130 # Failure message: test/nvimpager_spec.lua:136: Expected objects to be equal. # Passed in: # (string) ' # some text # ' # Expected: # (string) 'some text # ' ok 18 - cat mode can change the default foreground color with --cmd, setting notermguicolors input via stdin not ok 19 - cat mode can change the default foreground color with -c, setting notermguicolors # test/nvimpager_spec.lua @ 130 # Failure message: test/nvimpager_spec.lua:136: Expected objects to be equal. # Passed in: # (string) ' # some text # ' # Expected: # (string) 'some text # ' ok 20 - cat mode can change the default foreground color with -c, setting notermguicolors input via stdin not ok 21 - cat mode with modeline highlights files even after mode line files # test/nvimpager_spec.lua @ 144 # Failure message: test/nvimpager_spec.lua:150: Expected objects to be equal. # Passed in: # (string) '\ss should be ß # # a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' # Expected: # (string) '\ss should be ß # # a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # ' not ok 22 - cat mode with modeline honors mode lines in later files # test/nvimpager_spec.lua @ 153 # Failure message: test/nvimpager_spec.lua:159: Expected objects to be equal. # Passed in: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # \ss should be ß # ' # Expected: # (string) '# a test makefile # PREFIX = nothing # all: nothing # run command --option=$(PREFIX) # \ss should be ß # ' not ok 23 - cat mode with modeline ignores mode lines in diffs # test/nvimpager_spec.lua @ 162 # Failure message: test/nvimpager_spec.lua:165: Expected objects to be equal. # Passed in: # (string) 'diff --git a/nvimpager b/nvimpager # index d7d4e2f..99fb715 100755 # --- a/nvimpager # +++ b/nvimpager # @@ -104,4 +104,4 @@ then # default_args+=(--headless) # fi # nvim "${default_args[@]}" "${files[@]}" "$@" # Date: Mon Aug 20 23:37:04 2018 +0200 # # This is based on the log entry of 3d032f9e546fc8a1e987bbbef54e8dab1ceaf4bd # but was modiefied for the tests. # # The last line is turned into a valid modeline even with the diff prefix. # If it is interpreted it should result in an error message. # # diff --git a/test/fixtures/help.txt b/test/fixtures/help.txt # index ad4baf6..ab64439 100644 # --- a/test/fixtures/help.txt # +++ b/test/fixtures/help.txt # @@ -1,3 +1,3 @@ # -vim: filetype=help # *conceal-test* normal # conceal-test # + vim: foobar=error # ' # Expected: # (string) 'commit 3d032f9e546fc8a1e987bbbef54e8dab1ceaf4bd # Author: Lucas Hoffmann # Date: Mon Aug 20 23:37:04 2018 +0200 # # This is based on the log entry of 3d032f9e546fc8a1e987bbbef54e8dab1ceaf4bd # but was modiefied for the tests. # # The last line is turned into a valid modeline even with the diff prefix. # If it is interpreted it should result in an error message. # # diff --git a/test/fixtures/help.txt b/test/fixtures/help.txt # index ad4baf6..ab64439 100644 # --- a/test/fixtures/help.txt # +++ b/test/fixtures/help.txt # @@ -1,3 +1,3 @@ # -vim: filetype=help # *conceal-test* normal # conceal-test # + vim: foobar=error # ' not ok 26 - cat mode conceals are removed at conceallevel=2 # test/nvimpager_spec.lua @ 190 # Failure message: test/nvimpager_spec.lua:188: Expected objects to be equal. # Passed in: # (string) '*conceal-test* normal # conceal-test # vim: filetype=help # ' # Expected: # (string) 'conceal-test normal # conceal-test # vim: filetype=help # ' not ok 27 - cat mode conceals are hidden at conceallevel=1 # test/nvimpager_spec.lua @ 191 # Failure message: test/nvimpager_spec.lua:188: Expected objects to be equal. # Passed in: # (string) '*conceal-test* normal # conceal-test # vim: filetype=help # ' # Expected: # (string) ' conceal-test normal # conceal-test # vim: filetype=help # ' not ok 28 - cat mode conceals are highlighted at conceallevel=0 # test/nvimpager_spec.lua @ 192 # Failure message: test/nvimpager_spec.lua:188: Expected objects to be equal. # Passed in: # (string) '*conceal-test* normal # conceal-test # vim: filetype=help # ' # Expected: # (string) '*conceal-test* normal # conceal-test # vim: filetype=help # ' not ok 29 - cat mode conceal replacements are replaced at conceallevel=2 # test/nvimpager_spec.lua @ 203 # Failure message: test/nvimpager_spec.lua:201: Expected objects to be equal. # Passed in: # (string) 'ß should be ß # ' # Expected: # (string) 'ß should be ß # ' not ok 30 - cat mode conceal replacements are replaced at conceallevel=1 # test/nvimpager_spec.lua @ 204 # Failure message: test/nvimpager_spec.lua:201: Expected objects to be equal. # Passed in: # (string) 'ß should be ß # ' # Expected: # (string) 'ß should be ß # ' not ok 31 - cat mode conceal replacements are highlighted at conceallevel=0 # test/nvimpager_spec.lua @ 205 # Failure message: test/nvimpager_spec.lua:201: Expected objects to be equal. # Passed in: # (string) '\ss should be ß # ' # Expected: # (string) '\ss should be ß # ' not ok 32 - cat mode listchars handle spaces, trailing spaces and eol with termguicolors # test/nvimpager_spec.lua @ 209 # Failure message: test/nvimpager_spec.lua:213: Expected objects to be equal. # Passed in: # (string) 'Here_are_spaces.$ # And_two_trailing_space:--$ # ' # Expected: # (string) 'Here_are_spaces.$ # And_two_trailing_space:--$ # ' not ok 33 - cat mode listchars handle spaces, trailing spaces and eol with 256 colors # test/nvimpager_spec.lua @ 215 # Failure message: test/nvimpager_spec.lua:219: Expected objects to be equal. # Passed in: # (string) 'Here_are_spaces.$ # And_two_trailing_space:--$ # ' # Expected: # (string) 'Here_are_spaces.$ # And_two_trailing_space:--$ # ' not ok 34 - cat mode listchars handles non breaking spaces in utf8 files # test/nvimpager_spec.lua @ 223 # Failure message: test/nvimpager_spec.lua:226: Expected objects to be equal. # Passed in: # (string) 'nbsp+nbsp # ' # Expected: # (string) 'nbsp+nbsp # ' not ok 35 - cat mode listchars handles non breaking spaces in latin1 files # test/nvimpager_spec.lua @ 228 # Failure message: test/nvimpager_spec.lua:231: Expected objects to be equal. # Passed in: # (string) 'nbsp+nbsp # ' # Expected: # (string) 'nbsp+nbsp # ' ok 36 - pager mode starts up and quits correctly #mac #appimage #ppa ok 37 - cat-exec mode is selected when stdin is not a tty ok 38 - cat-exec mode does not highlight files ok 39 - parent detection detects git correctly #mac #appimage ok 40 - parent detection detects man correctly #mac #appimage not ok 41 - parent detection handles git # test/nvimpager_spec.lua @ 279 # Failure message: test/nvimpager_spec.lua:283: Expected objects to be equal. # Passed in: # (string) 'diff --git a/test/nvimpager_spec.lua b/test/nvimpager_spec.lua # index 68e2097..4593495 100644 # --- a/test/nvimpager_spec.lua # +++ b/test/nvimpager_spec.lua # @@ -405,3 +405,17 @@ describe("lua functions", function() # end) # end) # end) # + # +describe("parent detection", function() # + it("handles git", function() # + local output = run("test/fixtures/bin/git ./nvimpager -c test/fixtures/diff") # + local expected = read("test/fixtures/diff.ansi") # + assert.equal(expected, output) # + end) # + # + it("handles man", function() # + local output = run("test/fixtures/bin/man ./nvimpager -c test/fixtures/man.cat") # + local expected = read("test/fixtures/man.ansi") # + assert.equal(expected, output) # + end) # +end) # ' # Expected: # (string) 'diff --git a/test/nvimpager_spec.lua b/test/nvimpager_spec.lua # index 68e2097..4593495 100644 # --- a/test/nvimpager_spec.lua # +++ b/test/nvimpager_spec.lua # @@ -405,3 +405,17 @@ describe("lua functions", function() # end) # end) # end) # + # +describe("parent detection", function() # + it("handles git", function() # + local output = run("test/fixtures/bin/git ./nvimpager -c test/fixtures/diff") # + local expected = read("test/fixtures/diff.ansi") # + assert.equal(expected, output) # + end) # + # + it("handles man", function() # + local output = run("test/fixtures/bin/man ./nvimpager -c test/fixtures/man.cat") # + local expected = read("test/fixtures/man.ansi") # + assert.equal(expected, output) # + end) # +end) # ' ok 42 - parent detection can pass though git colors ok 43 - init files can be specified with -u ok 44 - init files can be init.lua ok 45 - init files can be init.vim ok 46 - lua functions split_rgb_number handles numbers from 0 to 16777215 ok 47 - lua functions split_rgb_number correctly splits rgb values ok 48 - lua functions group2ansi calls nvim_get_hl_by_id with and without termguicolors ok 49 - lua functions color2escape_24bit creates foreground escape sequences ok 50 - lua functions color2escape_24bit creates background escape sequences ok 51 - lua functions color2escape_8bit creates 8 colors foreground escaape sequences ok 52 - lua functions color2escape_8bit creates 8 colors background escaape sequences ok 53 - lua functions color2escape_8bit creates 16 colors foreground escaape sequences ok 54 - lua functions color2escape_8bit creates 16 colors background escaape sequences ok 55 - lua functions color2escape_8bit creates foreground escape sequences ok 56 - lua functions color2escape_8bit creates background escape sequences ok 57 - lua functions hexformat_rgb_numbers small numbers ok 58 - lua functions hexformat_rgb_numbers big numbers ok 59 - lua functions hexformat_rgb_numbers 0,0,0 is black ok 60 - lua functions hexformat_rgb_numbers 255,255,255 is white ok 61 - lua functions split_predifined_terminal_color handles 0 as black ok 62 - lua functions split_predifined_terminal_color handles 215 as white ok 63 - lua functions split_predifined_terminal_color handles 137 as something ok 64 - lua functions replace_prefix can replace a simple prefix in a table of strings ok 65 - lua functions replace_prefix can replace strings with slashes ok 66 - lua functions replace_prefix only replaces at the start of the items ok 67 - lua functions replace_prefix can replace lua pattern chars ok 68 - lua functions tokenize treats empty strings as a single empty token ok 69 - lua functions tokenize simple numbers ok 70 - lua functions tokenize trailing semicolons as extra empty token ok 71 - lua functions tokenize leading semicolons as extra empty token ok 72 - lua functions tokenize splits simple numbers at semicolons ok 73 - lua functions tokenize recognizes special 8 bit color sequences ok 74 - lua functions tokenize recognizes next token after 8 bit color sequences ok 75 - lua functions tokenize recognizes special 24 bit color sequences ok 76 - lua functions tokenize recognizes next token after 24 bit color sequences ok 77 - lua functions tokenize two semicolon between proper tokens create an empty token ok 78 - lua functions tokenize sequences of semicolons: one single semicolon => one empty token ok 79 - lua functions tokenize sequences of semicolons: two semicolons => two empty tokens ok 80 - lua functions ansi parser clears all attributes on 0 ok 81 - lua functions ansi parser can parse special terminal attributes: 7 is reverse ok 82 - lua functions ansi parser can parse special terminal attributes: 8 is conceal ok 83 - lua functions ansi parser can parse special terminal attributes: 3 is italic ok 84 - lua functions ansi parser can parse special terminal attributes: 1 is bold ok 85 - lua functions ansi parser can parse special terminal attributes: 4 is underline ok 86 - lua functions ansi parser can parse special terminal attributes: 9 is strikethrough ok 87 - lua functions ansi parser can parse foreground colors: 30 is black ok 88 - lua functions ansi parser can parse foreground colors: 32 is green ok 89 - lua functions ansi parser can parse foreground colors: 37 is lightgray ok 90 - lua functions ansi parser can parse foreground colors: 33 is yellow ok 91 - lua functions ansi parser can parse foreground colors: 31 is red ok 92 - lua functions ansi parser can parse foreground colors: 34 is blue ok 93 - lua functions ansi parser can parse foreground colors: 35 is magenta ok 94 - lua functions ansi parser can parse foreground colors: 36 is cyan ok 95 - lua functions ansi parser can parse background colors: 40 is black ok 96 - lua functions ansi parser can parse background colors: 42 is green ok 97 - lua functions ansi parser can parse background colors: 47 is lightgray ok 98 - lua functions ansi parser can parse background colors: 43 is yellow ok 99 - lua functions ansi parser can parse background colors: 41 is red ok 100 - lua functions ansi parser can parse background colors: 44 is blue ok 101 - lua functions ansi parser can parse background colors: 45 is magenta ok 102 - lua functions ansi parser can parse background colors: 46 is cyan ok 103 - lua functions ansi parser can parse color combinations ok 104 - lua functions ansi parser parses sequences that partly override themself ok 105 - lua functions ansi parser can turn off foreground colors ok 106 - lua functions ansi parser can turn off background colors ok 107 - lua functions ansi parser can turn off selected terminal attributes ok 108 - lua functions ansi parser parses 24 bit sequences parses simple 24 bit foreground colors ok 109 - lua functions ansi parser parses 24 bit sequences parses 24 bit foreground colors ok 110 - lua functions ansi parser parses 24 bit sequences parses simple 24 bit background colors ok 111 - lua functions ansi parser parse 256 colors parses pallet terminal colors (fg) ok 112 - lua functions ansi parser parse 256 colors parses pallet terminal colors (bg) ok 113 - lua functions ansi parser parse 256 colors parses high colors (fg) ok 114 - lua functions ansi parser parse 256 colors parses high colors (bg) ok 115 - lua functions ansi parser parse 256 colors parses color cube colors (fg) ok 116 - lua functions ansi parser parse 256 colors parses color cube colors (bg) ok 117 - lua functions ansi parser parse 256 colors parses grayscale ramp colors (fg) ok 118 - lua functions ansi parser parse 256 colors parses grayscale ramp colors (bg) ok 119 - lua functions ansi parser parse8bit parses pallet terminal colors (fg) ok 120 - lua functions ansi parser parse8bit parses pallet terminal colors (bg) ok 121 - lua functions ansi parser parse8bit parses high colors (fg) ok 122 - lua functions ansi parser parse8bit parses high colors (bg) ok 123 - lua functions ansi parser parse8bit parses color cube colors (fg) ok 124 - lua functions ansi parser parse8bit parses color cube colors (bg) ok 125 - lua functions ansi parser parse8bit parses grayscale ramp colors (fg) ok 126 - lua functions ansi parser parse8bit parses grayscale ramp colors (bg) ok 127 - lua functions detect_man_page_helper detects lines with each char overwritten by itself ok 128 - lua functions detect_man_page_helper works with leading whitespace ok 129 - lua functions detect_man_page_helper works for non captial letters ok 130 - lua functions detect_man_page_helper fails if some chars are not overwritten ok 131 - lua functions detect_man_page_helper detects lines with underscores overwritten by anything ok 132 - lua functions detect_man_page_helper does not accept an empty line ok 133 - lua functions check_escape_sequences only checks files with filetype 'text' ok 134 - lua functions check_escape_sequences finds ansi escape sequences ok 135 - lua functions detect_parent_process detects man ok 136 - lua functions detect_parent_process detects pydoc ok 137 - lua functions detect_parent_process detects ruby ok 138 - lua functions detect_parent_process detects perl ok 139 - lua functions detect_parent_process detects git ok 140 - lua functions detect_parent_process returns nil for unknown parents 1..140 make: *** [makefile:38: test] Error 1 ```
lucc commented 4 months ago

Some tests depend on the default colorscheme of nvim and that changed between 0.9 and 0.10. I have now added code to deactivate these tests in the flake and in ci so they should be "green" again. The actual issue is still unresolved. There are several possible solutions:

I am undecided which I want to do, I think I prefer 1 or 2.

lucc commented 4 months ago

I have introduced a temporary workaround for this issue: The failing test are all marked and can be skipped when running the tests. With 738a81ec729418a7029e099bff91c255606ab59f you can deactivate them with the busted tag v10. For example run make tests BUSTED='busted --exclude-tags=v10.

lucc commented 4 months ago

I do not consider this fixed. The skipping of the broken tests is only a workaround.