module RatatuiRuby::TestHelper::Terminal

Terminal setup and buffer inspection for TUI tests.

Testing TUIs against a real terminal is slow, flaky, and hard to automate. Initializing, cleaning up, and inspecting terminal state by hand is tedious.

This mixin wraps a headless test terminal. It handles setup, teardown, and provides methods to query buffer content, cursor position, and cell styles.

Use it to write fast, deterministic tests for your TUI applications.

Example

class MyTest < Minitest::Test
  include RatatuiRuby::TestHelper

  def test_rendering
    with_test_terminal(80, 24) do
      MyApp.new.run_once
      assert_includes buffer_content.join, "Hello"
    end
  end
end