/vendor/gems/facets-2.4.5/test/core/binding/test_opvars.rb
Ruby | 24 lines | 18 code | 5 blank | 1 comment | 0 complexity | 0b22123a837aeef0db858763d2257e86 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- require 'facets/binding/opvars'
- 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_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