Sha256: 30feeadfa83aeca53fa2b41430e748b704f91c30f2d66e921e7e7d740e423a1d

Contents?: true

Size: 1017 Bytes

Versions: 1

Compression:

Stored size: 1017 Bytes

Contents

require 'test/unit'
require 'thread_frame'
require_relative '../../app/core'
require_relative '../../app/mock'
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, opts={})
      @msgs << message
    end
    def @cmdproc.msgs
      @msgs
    end
    def @cmdproc.errmsg(message, opts={})
      @errmsgs << message
    end
    def @cmdproc.errmsgs
      @errmsgs
    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

1 entries across 1 versions & 1 rubygems

Version Path
trepanning-0.1.3 test/unit/cmd-helper.rb