Sha256: f4e968efd8662a5cf3a16326d5e9c2f1b3f71993500efd56e7b7f20ef5671c8f

Contents?: true

Size: 815 Bytes

Versions: 18

Compression:

Stored size: 815 Bytes

Contents

#!/usr/bin/env ruby
require 'test/unit'
require 'rubygems'; require 'require_relative'
require_relative '../../processor/hook'

# Test Debugger:CmdProcessor Hook portion
class TestProcHook < Test::Unit::TestCase

  def test_basic
    @args = []
    hook1 = Proc.new {|name, a| @args << [name, a]}
    hooks = Trepan::CmdProcessor::Hook.new()
    assert_equal(true, hooks.empty?)
    hooks.insert(-1, 'hook1', hook1)
    hooks.run
    assert_equal([['hook1', nil]], @args)
    hooks.insert_if_new(-1, 'hook1', hook1)
    assert_equal([['hook1', nil]], @args)
    
    @args = []
    hooks.insert_if_new(-1, 'hook2', hook1)
    hooks.run(10)
    assert_equal([['hook1', 10], ['hook2', 10]], @args)

    @args = []
    hooks.delete_by_name('hook2')
    hooks.run(30)
    assert_equal([['hook1', 30]], @args)
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
rbx-trepanning-0.2.1-universal-rubinius-2.0 test/unit/test-proc-hook.rb
rbx-trepanning-0.2.1-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.2.0-universal-rubinius-2.0 test/unit/test-proc-hook.rb
rb8-trepanning-0.1.6 test/unit/test-proc-hook.rb
rb8-trepanning-0.1.5 test/unit/test-proc-hook.rb
rbx-trepanning-0.1.0-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rb8-trepanning-0.1.4 test/unit/test-proc-hook.rb
rb8-trepanning-0.1.3 test/unit/test-proc-hook.rb
rb8-trepanning-0.1.3-universal-ruby-1.9.2 test/unit/test-proc-hook.rb
rb8-trepanning-0.1.3-universal-ruby-1.8.7 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.8-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.7-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.6-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.5-universal-rubinius-1.2.1 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.4-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.3-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.2-universal-rubinius-1.2 test/unit/test-proc-hook.rb
rbx-trepanning-0.0.1-universal-rubinius test/unit/test-proc-hook.rb