fedora-migrator /vendor/gems/facets-2.4.5/test/core/binding/test_caller.rb

Language Ruby Lines 45
MD5 Hash 6a239adf41f3e4fd2a6bb3b464c707d7 Estimated Cost $728 (why?)
Repository https://bitbucket.org/mediashelf/fedora-migrator View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'facets/binding/caller.rb'
require 'test/unit'

class TestBindingCallStack < Test::Unit::TestCase

  def setup
    a = 1
    b = 2
    x = "hello"
    # the line number must be updated if it moves
    @bind = binding; @this_line_no = __LINE__
    @this_file_name = File.basename( __FILE__ ) # why does it equal basename only?
  end

  def test___LINE__
    assert_equal( @this_line_no, @bind.__LINE__ )
  end

  def test___FILE__
    assert_equal( @this_file_name, File.basename( @bind.__FILE__ ) )
  end

  def test___DIR__
    assert_equal( File.dirname( @bind.__FILE__ ), @bind.__DIR__ )
  end

  def test_callstack
    assert_instance_of( Array, @bind.callstack )
  end

  def test_caller
    # how to test?
    assert_nothing_raised{ @bind.caller }
  end

  def test_callee
    assert_equal( :setup, @bind.__callee__ )
  end

  def test_method
    assert_equal( 'setup', @bind.__method__ )
  end

end
Back to Top