Sha256: 242ce4cdfb676e345bf7e6cd1e534665f73c562e1288df4ae8768fdb0d7fa0fa

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

# Test for facets/binding/vars.rb

require 'facets/binding/vars.rb'

require 'test/unit'

class TestBindingVariables < 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_local_variables
    assert_equal( ["a","b","x"], @bind.local_variables )
  end

  def test_op_store
    assert_nothing_raised{ @bind["x"] = "goodbye" }
    assert_equal( "goodbye", @bind["x"] )
  end

  def test_op_fetch
    assert_equal( "hello", @bind["x"] )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.3.0 test/core/binding/test_vars.rb
facets-2.2.0 test/unit/binding/test_vars.rb
facets-2.2.1 test/unit/binding/test_vars.rb