Sha256: bf072ef3d3cd0916234a5a07573665e2421e2ae46345bef563d166d05f1ea05c

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

#!/usr/bin/env ruby
require 'test/unit'
require_relative '../../processor'
require_relative '../../processor/list'
require_relative '../../app/mock'

# Test Trepan::CmdProcessor List portion
class TestProcList < Test::Unit::TestCase

  def setup
    $errors = []
    $msgs   = []
    @proc    = Trepan::CmdProcessor.new(Trepan::MockCore.new())
    @proc.frame_index = 0
    @proc.frame_initialize
    class << @proc
      def msg(msg)
        $msgs << msg
      end
      def errmsg(msg)
        $errors << msg
      end
      def print_location
        # $msgs << "#{@frame.source_container} #{@frame.source_location[0]}"
        $msgs << "#{@frame.source_container} "
        # puts $msgs
      end
    end
  end

  def test_basic
    @proc.frame_setup(RubyVM::Frame.get)

    def foo; 5 end
    def check(cmdp, arg, last=10)
      r =  cmdp.parse_list_cmd('.', last)
      assert r[1]
      assert r[2]
      assert r[3]
    end
    check(@proc, '-')
    check(@proc, 'foo')
    check(@proc, '@0')
    check(@proc, "#{__LINE__}")
    check(@proc, "#{__FILE__}   @0")
    check(@proc, "#{__FILE__}:#{__LINE__}")
    check(@proc, "#{__FILE__} #{__LINE__}")
    check(@proc, "#{__FILE__} #{__LINE__}", -10)
    check(@proc, "@proc.errmsg")
    check(@proc, "@proc.errmsg:@0")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trepanning-2.15.35 test/unit/test-proc-list.rb
trepanning-2.15.33 test/unit/test-proc-list.rb