Sha256: 9c2790e4f29d20b8d0f83fed11ff58f12d390b638856b31de66300be87e99cce

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

require 'test/unit'
require 'rubygems'; require 'require_relative'
require_relative '../../processor/mock'
require_relative '../../processor/frame'


module UnitHelper

  module_function
  def common_setup
    @dbg      ||= MockDebugger::MockDebugger.new(:nx => true)
    @cmdproc  ||= Trepan::CmdProcessor.new(@dbg.intf)
    @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

  def common_teardown
    @cmdproc.finalize
  end
  
  def reset_cmdproc_vars
    @cmdproc.instance_variable_set('@msgs', [])
    @cmdproc.instance_variable_set('@errmsgs', [])
  end

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
rb8-trepanning-0.1.6 test/unit/cmd-helper.rb
rb8-trepanning-0.1.5 test/unit/cmd-helper.rb
rb8-trepanning-0.1.4 test/unit/cmd-helper.rb