class Cradare2::Transport::MockTransport

Overview

A mock transport for testing without requiring a live radare2 process.

Defined in:

cradare2/transport/mock.cr

Constructors

Instance Method Summary

Instance methods inherited from class Cradare2::Transport::Base

close : Nil close, closed? : Bool closed?, cmd(command : String) : String cmd, timeout : Time::Span | Nil timeout, timeout=(timeout : Time::Span | Nil) timeout=

Constructor Detail

def self.new(default_handler : Nil | String -> String = nil) #

[View source]

Instance Method Detail

def close : Nil #
Description copied from class Cradare2::Transport::Base

Closes the transport and releases any associated resources.


[View source]
def closed? : Bool #
Description copied from class Cradare2::Transport::Base

Returns true if the transport has been closed.


[View source]
def cmd(command : String) : String #
Description copied from class Cradare2::Transport::Base

Executes a command string in radare2 and returns the response string.


[View source]
def default(&block : String -> String) : self #

Sets a default fallback block when no handler matches.


[View source]
def history : Array(String) #

[View source]
def on(command : String, response : String) : self #

Registers a mock response for an exact command string.


[View source]
def on(command : String, &block : String -> String) : self #

Registers a dynamic mock block handler for an exact command string.


[View source]
def on(pattern : Regex, &block : String -> String) : self #

Registers a mock dynamic block handler for a regex command match.


[View source]
def reset : Nil #

[View source]