class
Opal::Testing::TestProgram
- Opal::Testing::TestProgram
- Reference
- Object
Overview
Charmbracelet Bubbletea-inspired TestProgram test harness. Wraps a TEA Model/Program running concurrently, enabling programmatic key typing, concurrent message injection (send), output assertion, and graceful termination waiting.
Defined in:
opal/testing/teatest.crConstructors
-
.new(model : TEA::Model, width : Int32 = 80, height : Int32 = 24, alt_screen : Bool = false, mouse_enabled : Bool = false, diff_render : Bool = false) : self
Factory constructor
Instance Method Summary
- #driver : Terminal::MockDriver
- #error : Exception | Nil
- #final_model : TEA::Model | Nil
- #finished? : Bool
-
#key(name : String, char : Char | Nil = nil, ctrl : Bool = false, alt : Bool = false, shift : Bool = false) : self
Dispatches a single key into the program's input stream.
-
#output : String
Returns the recorded output stripped of ANSI escapes.
- #program : TEA::Program
-
#quit : self
Programmatically requests program exit.
-
#raw_output : String
Returns the raw recorded output with ANSI escapes preserved.
-
#send(msg : TEA::Msg) : self
Sends a message directly into the active application event loop (matching Bubbletea p.Send).
-
#type(text : String) : self
Simulates typing text into the program's input stream.
-
#wait_finished(timeout : Time::Span = 2.seconds) : TEA::Model
Waits for the TEA program to exit cleanly and returns the final Model state.
-
#wait_for(timeout : Time::Span = 1.second, interval : Time::Span = 5.milliseconds, message : String = "Condition timed out waiting for output assertion", &block : String -> Bool) : self
Waits until output matches the condition block within the specified timeout.
Constructor Detail
Factory constructor
Instance Method Detail
Dispatches a single key into the program's input stream.
Sends a message directly into the active application event loop (matching Bubbletea p.Send).
Waits for the TEA program to exit cleanly and returns the final Model state.
Waits until output matches the condition block within the specified timeout.