/vendor/gems/facets-2.4.5/test/core/binding/test_opvars.rb

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 24 lines · 18 code · 5 blank · 1 comment · 0 complexity · 0b22123a837aeef0db858763d2257e86 MD5 · raw file

  1. require 'facets/binding/opvars'
  2. require 'test/unit'
  3. class TestBindingVariables < Test::Unit::TestCase
  4. def setup
  5. a = 1
  6. b = 2
  7. x = "hello"
  8. # the line number must be updated if it moves
  9. @bind = binding; @this_line_no = __LINE__
  10. @this_file_name = File.basename( __FILE__ ) # why does it equal basename only?
  11. end
  12. def test_op_store
  13. assert_nothing_raised{ @bind["x"] = "goodbye" }
  14. assert_equal( "goodbye", @bind["x"] )
  15. end
  16. def test_op_fetch
  17. assert_equal( "hello", @bind["x"] )
  18. end
  19. end