commit a17638d388636713308d320d5a826c1ef2a0e398
parent d21b4bebeb134b1cccefdb1c669542cc2d109b3e
Author: Dan Callaghan <djc@djc.id.au>
Date: Mon, 5 Oct 2026 21:13:42 +1100
tests: fix TestLineCursorMode failures due to Ncurses.tigetflag
The previous commit d21b4bebeb134b1cccefdb1c669542cc2d109b3e introduced
a call to Ncurses.tigetflag in BufferManager, but that method is only
defined after Ncurses.initscr or Ncurses.newterm have been called.
Fix TestLineCursorMode to initialise a dummy ncurses terminal on
/dev/null so that BufferManager can work in unit tests.
TestLineCursorMode#test_jump_to_end:
NoMethodError: undefined method `tigetflag' for Ncurses:Module
@have_xterm_title = Ncurses.tigetflag("XT") > 0 || ENV["TERM"] =~ /(screen|tmux)/
^^^^^^^^^^
lib/sup/buffer.rb:154:in `initialize'
lib/sup/util.rb:594:in `new'
lib/sup/util.rb:594:in `init'
test/unit/test_line_cursor_mode.rb:13:in `setup'
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/unit/test_line_cursor_mode.rb b/test/unit/test_line_cursor_mode.rb
@@ -10,6 +10,9 @@ class TestLineCursorMode < Minitest::Test
:load_more_threads_when_scrolling => true,
:continuous_scroll => false,
}
+ @out = File.open File::NULL, "w"
+ @inp = File.open File::NULL, "r"
+ @screen = Ncurses.newterm "dumb", @out, @inp
Redwood::BufferManager.init
@modes_to_cleanup = []
@lines = []
@@ -20,6 +23,9 @@ class TestLineCursorMode < Minitest::Test
def teardown
@modes_to_cleanup.each { |mode| mode.cleanup }
Redwood::BufferManager.deinstantiate!
+ Ncurses.delscreen @screen
+ @inp.close
+ @out.close
$config = nil
end