Sha256: 137b91dda879256eee8b113efd28026c9e2c3343f09fd368886175b9a0ec3f62

Contents?: true

Size: 768 Bytes

Versions: 14

Compression:

Stored size: 768 Bytes

Contents

#!/usr/bin/env ruby
require 'test/unit'
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

14 entries across 14 versions & 1 rubygems

Version Path
trepanning-2.15.35 test/unit/test-proc-hook.rb
trepanning-1.93.35 test/unit/test-proc-hook.rb
trepanning-2.15.33 test/unit/test-proc-hook.rb
trepanning-1.93.32 test/unit/test-proc-hook.rb
trepanning-0.1.6 test/unit/test-proc-hook.rb
trepanning-0.1.4 test/unit/test-proc-hook.rb
trepanning-0.1.3 test/unit/test-proc-hook.rb
trepanning-0.1.2 test/unit/test-proc-hook.rb
trepanning-0.1.1 test/unit/test-proc-hook.rb
trepanning-0.1.0 test/unit/test-proc-hook.rb
trepanning-0.0.9 test/unit/test-proc-hook.rb
trepanning-0.0.8 test/unit/test-proc-hook.rb
trepanning-0.0.6 test/unit/test-proc-hook.rb
trepanning-0.0.4 test/unit/test-proc-hook.rb