Sha256: c1894ed7194c43fed5fec34943d2d5cc8844a02995d6f7aaaec6dfd1560cc684

Contents?: true

Size: 1.38 KB

Versions: 18

Compression:

Stored size: 1.38 KB

Contents

class TestInterface < Byebug::Interface
  attr_reader :input_queue, :output_queue, :error_queue, :confirm_queue

  attr_accessor :command_queue, :histfile, :history_length, :history_save
  attr_accessor :print_queue, :readline_support, :restart_file, :test_block

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

  def errmsg(*args)
    @error_queue << format(args)
  end

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

  def print(*args)
    @output_queue << format(args)
  end

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

  def readline_support?
    @readline_support
  end

  def finalize
  end

  def close
  end

  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

  private

    def format(args)
      if args.size > 1
        args.first % args[1..-1]
      else
        args.first
      end
    end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
byebug-1.8.1 test/support/test_interface.rb
byebug-1.8.0 test/support/test_interface.rb
byebug-1.7.0 test/support/test_interface.rb
byebug-1.6.1 test/support/test_interface.rb
byebug-1.6.0 test/support/test_interface.rb
byebug-1.5.0 test/support/test_interface.rb
byebug-1.4.2 test/support/test_interface.rb
byebug-1.4.1 test/support/test_interface.rb
byebug-1.4.0 test/support/test_interface.rb
byebug-1.3.1 test/support/test_interface.rb
byebug-1.3.0 test/support/test_interface.rb
byebug-1.2.0 test/support/test_interface.rb
byebug-1.1.1 test/support/test_interface.rb
byebug-1.1.0 test/support/test_interface.rb
byebug-1.0.3 test/support/test_interface.rb
byebug-1.0.2 test/support/test_interface.rb
byebug-1.0.1 test/support/test_interface.rb
byebug-1.0.0 test/support/test_interface.rb