Sha256: 678e3ea5752ade198095f2d5ec9f04b48a597afc939feb89ea1a1f7837dafdca

Contents?: true

Size: 1.14 KB

Versions: 37

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby
require File.expand_path("helper", File.dirname(__FILE__))

# Test of Debugger.debug_load in C extension ruby_debug.so
class TestDebugLoad < Test::Unit::TestCase
  class << self
    def at_line(file, line)
      @@at_line = [File.basename(file), line]
    end
  end

  class Debugger::Context
    def at_line(file, line)
      TestDebugLoad::at_line(file, line)
    end
  end

  def test_debug_load
    src_dir = File.dirname(__FILE__)
    prog_script = File.join(src_dir, 'example', 'gcd.rb')

    # Without stopping
    bt = Debugger.debug_load(prog_script, false)
    assert_equal(nil, bt)
    assert(Debugger.started?)
    Debugger.stop

    # With stopping
    bt = Debugger.debug_load(prog_script, true)
    assert_equal(nil, bt)
    assert_equal(['gcd.rb', 4], @@at_line)
    assert(Debugger.started?)
    Debugger.stop

    # Test that we get a proper backtrace on a script that raises 'abc'
    prog_script = File.join(src_dir, 'example', 'raise.rb')
    bt = Debugger.debug_load(prog_script, false)
    assert_equal('abc', bt.to_s)
    assert(Debugger.started?)
    Debugger.stop
  ensure
    Debugger.stop if Debugger.started?
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
debase-0.2.3.beta2 test/test_load.rb
debase-0.2.2 test/test_load.rb
debase-0.2.2.beta14 test/test_load.rb
debase-0.2.2.beta13 test/test_load.rb
debase-0.2.2.beta12 test/test_load.rb
debase-0.2.2.beta11 test/test_load.rb
debase-0.2.2.beta10 test/test_load.rb
debase-0.2.2.beta9 test/test_load.rb
debase-0.2.2.beta8 test/test_load.rb
debase-0.2.2.beta7 test/test_load.rb
debase-0.2.2.beta6 test/test_load.rb
debase-0.2.2.beta5 test/test_load.rb
debase-0.2.2.beta4 test/test_load.rb
debase-0.2.2.beta3 test/test_load.rb
debase-0.2.2.beta2 test/test_load.rb
debase-0.2.2.beta1 test/test_load.rb
debase-0.2.1 test/test_load.rb
debase-0.2.0 test/test_load.rb
debase-0.2.0.beta1 test/test_load.rb
debase-0.1.8 test/test_load.rb