Class: TestInterface

Inherits:
Debugger::Interface show all
Defined in:
lib/debugger/test/test_interface.rb

Instance Attribute Summary collapse

Attributes inherited from Debugger::Interface

#have_readline

Instance Method Summary collapse

Methods inherited from Debugger::Interface

#afmt, #aprint, #print_debug

Constructor Details

#initializeTestInterface

Returns a new instance of TestInterface.



5
6
7
8
9
10
11
12
13
# File 'lib/debugger/test/test_interface.rb', line 5

def initialize
  @input_queue = []
  @output_queue = []
  @error_queue = []
  @confirm_queue = []
  @command_queue = []
  @print_queue = []
  @readline_support = false
end

Instance Attribute Details

#command_queueObject

Returns the value of attribute command_queue.



3
4
5
# File 'lib/debugger/test/test_interface.rb', line 3

def command_queue
  @command_queue
end

#confirm_queueObject (readonly)

Returns the value of attribute confirm_queue.



2
3
4
# File 'lib/debugger/test/test_interface.rb', line 2

def confirm_queue
  @confirm_queue
end

#error_queueObject (readonly)

Returns the value of attribute error_queue.



2
3
4
# File 'lib/debugger/test/test_interface.rb', line 2

def error_queue
  @error_queue
end

#histfileObject

Returns the value of attribute histfile.



4
5
6
# File 'lib/debugger/test/test_interface.rb', line 4

def histfile
  @histfile
end

#history_lengthObject

Returns the value of attribute history_length.



4
5
6
# File 'lib/debugger/test/test_interface.rb', line 4

def history_length
  @history_length
end

#history_saveObject

Returns the value of attribute history_save.



4
5
6
# File 'lib/debugger/test/test_interface.rb', line 4

def history_save
  @history_save
end

#input_queueObject (readonly)

Returns the value of attribute input_queue.



2
3
4
# File 'lib/debugger/test/test_interface.rb', line 2

def input_queue
  @input_queue
end

#output_queueObject (readonly)

Returns the value of attribute output_queue.



2
3
4
# File 'lib/debugger/test/test_interface.rb', line 2

def output_queue
  @output_queue
end

Returns the value of attribute print_queue.



3
4
5
# File 'lib/debugger/test/test_interface.rb', line 3

def print_queue
  @print_queue
end

#readline_supportObject

Returns the value of attribute readline_support.



4
5
6
# File 'lib/debugger/test/test_interface.rb', line 4

def readline_support
  @readline_support
end

#restart_fileObject

Returns the value of attribute restart_file.



4
5
6
# File 'lib/debugger/test/test_interface.rb', line 4

def restart_file
  @restart_file
end

#test_blockObject

Returns the value of attribute test_block.



3
4
5
# File 'lib/debugger/test/test_interface.rb', line 3

def test_block
  @test_block
end

Instance Method Details

#closeObject



44
45
# File 'lib/debugger/test/test_interface.rb', line 44

def close
end

#confirm(message) ⇒ Object



32
33
34
35
# File 'lib/debugger/test/test_interface.rb', line 32

def confirm(message)
  @confirm_queue << message
  read_command message
end

#empty?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/debugger/test/test_interface.rb', line 47

def empty?
  [input_queue, output_queue, error_queue, confirm_queue, print_queue].all?(&:empty?)
end

#errmsg(value) ⇒ Object



15
16
17
# File 'lib/debugger/test/test_interface.rb', line 15

def errmsg(value)
  @error_queue << value
end

#finalizeObject



41
42
# File 'lib/debugger/test/test_interface.rb', line 41

def finalize
end

#inspectObject



51
52
53
54
55
56
57
58
59
# File 'lib/debugger/test/test_interface.rb', line 51

def inspect
  [
    "input_queue: #{input_queue.inspect}",
    "output_queue: #{output_queue.inspect}",
    "error_queue: #{error_queue.inspect}",
    "confirm_queue: #{confirm_queue.inspect}",
    "print_queue: #{print_queue.inspect}"
  ].join("\n")
end


28
29
30
# File 'lib/debugger/test/test_interface.rb', line 28

def print(value)
  @output_queue << value
end

#read_command(*args) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/debugger/test/test_interface.rb', line 19

def read_command(*args)
  if @input_queue.empty? && test_block
    test_block.call
    self.test_block = nil
  end
  result = @input_queue.shift
  result.is_a?(Proc) ? result.call : result
end

#readline_support?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/debugger/test/test_interface.rb', line 37

def readline_support?
  @readline_support
end