Commit notifications for all Sup repositories
 help / color / mirror / Atom feed
* [sup.git] branch develop updated: tests: fix TestLineCursorMode failures due to Ncurses.tigetflag
@ 2026-10-05 10:16 Dan Callaghan
  0 siblings, 0 replies; only message in thread
From: Dan Callaghan @ 2026-10-05 10:16 UTC (permalink / raw)
  To: sup-commits

Pushed a commit to branch develop:
https://supmua.dev/git/sup/commit/a17638d388636713308d320d5a826c1ef2a0e398.html

The following commit(s) were added to refs/heads/develop by this push:
     new a17638d3 tests: fix TestLineCursorMode failures due to Ncurses.tigetflag
a17638d3 is described below

commit a17638d388636713308d320d5a826c1ef2a0e398
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Mon Oct 5 21:13:42 2026 +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'
---
 test/unit/test_line_cursor_mode.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/unit/test_line_cursor_mode.rb b/test/unit/test_line_cursor_mode.rb
index d22221c4..e8482db4 100644
--- 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
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-05 10:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 10:16 [sup.git] branch develop updated: tests: fix TestLineCursorMode failures due to Ncurses.tigetflag Dan Callaghan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox