Sha256: fffba885b93f751a8314c0a427d3c6462f830fe627029ae4bbc9506d7e873bc0

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 KB

Contents

  #  _____         _
  # |_   _|__  ___| |_
  #   | |/ _ \/ __| __|
  #   | |  __/\__ \ |
  #   |_|\___||___/\__|
  #
  # for lib/facets/binding/cflow.rb
  #
  # Extracted Mon Sep 03 16:23:07 -0700 2007
  # w/ Test Extraction Ratchet
  #

 require 'facets/binding/cflow.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_call_stack
      assert_instance_of( Array, @bind.call_stack )
    end

    def test_called
      assert_equal( :setup, @bind.called )
    end

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

    def test_methodname
      assert_equal( 'setup', @bind.methodname )
    end

  end



Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.0.0 test/unit/binding/test_cflow.rb
facets-2.0.1 test/unit/binding/test_cflow.rb
facets-2.0.2 test/unit/binding/test_cflow.rb
facets-2.0.3 test/unit/binding/test_cflow.rb
facets-2.0.4 test/unit/binding/test_cflow.rb
facets-2.0.5 test/unit/binding/test_cflow.rb
facets-2.1.0 test/unit/binding/test_cflow.rb
facets-2.1.1 test/unit/binding/test_cflow.rb
facets-2.1.2 test/unit/binding/test_cflow.rb
facets-2.1.3 test/unit/binding/test_cflow.rb