Sha256: e7aa98199c27d8b71697c491315c832e552ec46485f6ae1f71cf2bf6fc8648d9

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require 'test/unit'
require 'rubygems'; require 'require_relative'
# require_relative '../../app/core'
require_relative '../../processor/mock'
require_relative '../../processor/main' # Have to include before frame!
                                        # FIXME
require_relative '../../processor/frame'


module UnitHelper

  def common_setup
    @dbg      = MockDebugger::MockDebugger.new(:nx => true)
    @cmdproc  = Trepan::CmdProcessor.new(@dbg)
    @cmdproc.frame_initialize
    @cmdproc.dbgr  = @dbg
    @cmds     = @cmdproc.commands

    def @cmdproc.errmsg(message, opts={})
      @errmsgs << message
    end
    def @cmdproc.errmsgs
      @errmsgs
    end
    def @cmdproc.msg(message, opts={})
      @msgs << message
    end
    def @cmdproc.msgs
      @msgs
    end
    def @cmdproc.section(message, opts={})
      @msgs << message
    end
    reset_cmdproc_vars
  end
  module_function :common_setup
  
  def reset_cmdproc_vars
    @cmdproc.instance_variable_set('@msgs', [])
    @cmdproc.instance_variable_set('@errmsgs', [])
  end
  module_function :reset_cmdproc_vars
end

if __FILE__ == $0
  include UnitHelper
  common_setup
  p @cmdproc.msgs
  p @dbg
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rbx-trepanning-0.0.6-universal-rubinius-1.2 test/unit/cmd-helper.rb
rbx-trepanning-0.0.5-universal-rubinius-1.2.1 test/unit/cmd-helper.rb
rbx-trepanning-0.0.4-universal-rubinius-1.2 test/unit/cmd-helper.rb