Sha256: a2375b15b8ae641206f58abf67e7a43e7aa145fe9c7a00bc777235706e18ce79

Contents?: true

Size: 1003 Bytes

Versions: 4

Compression:

Stored size: 1003 Bytes

Contents

require_relative '../../app/core'
require_relative '../../app/mock'
require_relative '../../processor/main' # Have to include before frame!
                                        # FIXME
require_relative '../../processor/frame'


module UnitHelper

  def common_setup
    @dbg      = Trepan::MockDebugger.new(:nx => true)
    @core     = Trepan::Core.new(@dbg)
    @cmdproc  = @core.processor = Trepan::CmdProcessor.new(@core)
    @cmds     = @cmdproc.commands

    def @cmdproc.msg(message)
      @msgs << message
    end
    def @cmdproc.errmsg(message)
      @errmsgs << message
    end
    def @cmdproc.errmsgs
      @errmsgs
    end
    def @cmdproc.msgs
      @msgs
    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

4 entries across 4 versions & 1 rubygems

Version Path
trepanning-0.0.9 test/unit/cmd-helper.rb
trepanning-0.0.8 test/unit/cmd-helper.rb
trepanning-0.0.6 test/unit/cmd-helper.rb
trepanning-0.0.4 test/unit/cmd-helper.rb