Created
April 24, 2010 19:56
-
-
Save BanzaiMan/377903 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [system]:test[git:master] $ jruby -v test_jruby_4680.rb | |
| jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-04-24 142fc60) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [x86_64-java] | |
| Loaded suite test_jruby_4680 | |
| Started | |
| F..F | |
| Finished in 0.115 seconds. | |
| 1) Failure: | |
| test_method_selection_float1(TestMethodSelection) [test_jruby_4680.rb:12]: | |
| <"float"> expected but was | |
| <"integer">. | |
| 2) Failure: | |
| test_method_selection_integer2(TestMethodSelection) [test_jruby_4680.rb:16]: | |
| <"integer"> expected but was | |
| <"float">. | |
| 4 tests, 4 assertions, 2 failures, 0 errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class JRuby4680 { | |
| public static String foo1(Integer arg) { | |
| return "integer"; | |
| } | |
| public static String foo1(Float arg) { | |
| return "float"; | |
| } | |
| public static String foo2(Object o, Integer arg) { | |
| return "integer"; | |
| } | |
| public static String foo2(Object o, Float arg) { | |
| return "float"; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'java' | |
| require 'test/unit' | |
| java_import 'JRuby4680' | |
| class TestMethodSelection < Test::Unit::TestCase | |
| def test_method_selection_integer1 | |
| assert_equal "integer", JRuby4680.foo1(0x531) | |
| end | |
| def test_method_selection_float1 | |
| assert_equal "float", JRuby4680.foo1(1.532) | |
| end | |
| def test_method_selection_integer2 | |
| assert_equal "integer", JRuby4680.foo2(Object.new, 0x531) | |
| end | |
| def test_method_selection_float2 | |
| assert_equal "float", JRuby4680.foo2(Object.new, 1.532) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment