Sha256: 4ee654f11584ffdb22a68a545f06edc426c9352580c3fe0511a7e5d92ddad17f

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 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, :start_frame =>1)
    @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

  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

2 entries across 2 versions & 1 rubygems

Version Path
rbx-trepanning-0.2.1-universal-rubinius-2.0 test/unit/cmd-helper.rb
rbx-trepanning-0.2.1-universal-rubinius-1.2 test/unit/cmd-helper.rb