test/unit/module/test_alias.rb in facets-2.1.3 vs test/unit/module/test_alias.rb in facets-2.2.0
- old
+ new
@@ -1,60 +1,47 @@
- # _____ _
- # |_ _|__ ___| |_
- # | |/ _ \/ __| __|
- # | | __/\__ \ |
- # |_|\___||___/\__|
- #
- # for lib/facets/module/alias.rb
- #
- # Extracted Mon Sep 03 16:23:07 -0700 2007
- # w/ Test Extraction Ratchet
- #
+# Test for facets/module/alias
- require 'facets/module/alias.rb'
+require 'facets/module/alias.rb'
+require 'test/unit'
+class TC_Module < Test::Unit::TestCase
- require 'test/unit'
+ module MockModule
+ # for alias_module_method
+ def x ; 33 ; end
+ module_function :x
+ alias_module_function :y, :x
+ end
- class TCModule < Test::Unit::TestCase
+ def test_alias_module_function
+ assert_equal( 33, MockModule.y )
+ #assert_equal( 33, @m.send(:y) ) # use send b/c private
+ end
- module MockModule
- # for alias_module_method
- def x ; 33 ; end
- module_function :x
- alias_module_function :y, :x
- end
- def test_alias_module_function
- assert_equal( 33, MockModule.y )
- #assert_equal( 33, @m.send(:y) ) # use send b/c private
+ module X
+ def self.included(base)
+ base.module_eval {
+ alias_method_chain :foo, :feature
+ }
end
-
- module X
- def self.included(base)
- base.module_eval {
- alias_method_chain :foo, :feature
- }
- end
- def foo_with_feature
- foo_without_feature + '!'
- end
+ def foo_with_feature
+ foo_without_feature + '!'
end
+ end
- class Y
- def foo
- "FOO"
- end
- include X
- #alias_method_chain :foo, :feature
+ class Y
+ def foo
+ "FOO"
end
+ include X
+ #alias_method_chain :foo, :feature
+ end
- def test_001
- y = Y.new
- assert_equal( "FOO!", y.foo )
- end
+ def test_001
+ y = Y.new
+ assert_equal( "FOO!", y.foo )
end
-
-
+end