module Opal::Testing::BufferAssertions

Overview

Ratatui-inspired 2D terminal buffer inspection and visual assertions.

Direct including types

Defined in:

opal/testing/buffer_assertions.cr

Instance Method Summary

Instance Method Detail

def assert_buffer_lines(buffer : UI::Buffer, expected : Array(String), trim_trailing : Bool = true, file = __FILE__, line = __LINE__) : Nil #

Asserts that the 2D buffer's rendered character grid matches the expected lines. Upon mismatch, constructs a formatted, readable visual diff highlighting line numbers and discrepancies.


[View source]
def assert_cell(buffer : UI::Buffer, x : Int32, y : Int32, char : Char | Nil = nil, fg : Color | Nil = nil, bg : Color | Nil = nil, bold : Bool | Nil = nil, underline : Bool | Nil = nil, dim : Bool | Nil = nil, italic : Bool | Nil = nil, file = __FILE__, line = __LINE__) : Nil #

Asserts a single cell's exact character and style properties at (x, y).


[View source]
def buffer_lines(buffer : UI::Buffer, trim_trailing : Bool = true) : Array(String) #

Extracts the text lines from a buffer.


[View source]
def driver_lines(driver : Terminal::MockDriver, trim_trailing : Bool = true) : Array(String) #

Extracts the text lines from a mock driver by inspecting its stripped output or frame.


[View source]