Sha256: d60a1dae0bbecd8ce709ccdeec2ccceec0fa94fccee77156a6dc561a4cb7556b

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'test/unit'
require 'thread_frame'
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, 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

3 entries across 3 versions & 1 rubygems

Version Path
trepanning-0.1.2 test/unit/cmd-helper.rb
trepanning-0.1.1 test/unit/cmd-helper.rb
trepanning-0.1.0 test/unit/cmd-helper.rb