Sha256: 728529b3a3232dab2d46e508ac94aeea70e01e46e9ab5f0144c0bc29d3503881
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'helper' class TestConstantRedefinition < Test::Unit::TestCase def test_can_define_a_constant_if_not_already_defined define_if_not_defined(:A, 1) assert_equal 1, A end def test_can_redefine_a_constant_if_already_defined define_if_not_defined(:B, 1) redefine_without_warning(:B, 2) assert_equal 2, B end def test_redefine_a_constant_sets_constant_if_not_already_defined redefine_without_warning(:C, 3) assert_equal 3, C end def test_can_define_a_constant_in_a_module_if_not_already_defined Math.define_if_not_defined(:FOO, 2 * Math::PI) assert_equal 2 * Math::PI, Math::FOO end def test_can_redefine_a_constant_in_a_module_if_already_defined Math.define_if_not_defined(:BAR, 3) Math.redefine_without_warning(:BAR, 5) assert_equal 5, Math::BAR end def test_redefine_a_constant_in_a_module_sets_constant_if_not_already_defined Math.redefine_without_warning(:AMAZING, 3) assert_equal 3, Math::AMAZING end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
constant-redefinition-1.0.0 | test/test_constant-redefinition.rb |