From: Rod S. <rsc...@xm...> - 2008-03-04 07:04:57
|
I'm trying to do some unit testing with RubyCocoa and am having some problems. I have a main program like so: int main(int argc, const char *argv[]) { return RBApplicationMain("../../PackRat/source/tests/rb_testmain.rb", argc, argv); } rb_testmain.rb is: require 'osx/cocoa' require 'test/unit/ui/console/testrunner' OSX.ns_import :Backpack class TC_PackRatTests < Test::Unit::TestCase def setup @backpack = Backpack.alloc.initWithSitename_token_ssl('username', '', false); end def teardown # Write teardown code here. end def test1 # Write first test here. end end if $0 == __FILE__ then Test::Unit::UI::Console::TestRunner.run(TC_PackRatTests) end When I run the program I get the following: /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:323:in `_ns_behavior_method_added': Cannot override Objective-C method 'chomp' with Ruby method #chomp, they should both have the same number of arguments. (expected arity 0, got -1) (RuntimeError) from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:646:in `method_added' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:718:in `define_method' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:718:in `_register_method' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:716:in `module_eval' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:716:in `_register_method' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_import.rb:730:in `method_added' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_attachments.rb:363 from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_all.rb:12:in `require' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ oc_all.rb:12 from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ foundation.rb:8:in `require' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ foundation.rb:8 from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ cocoa.rb:8:in `require' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/ cocoa.rb:8 from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/ cocoa.rb:8:in `require' from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/ cocoa.rb:8 from /Users/rod/Development/Projects/infiniteNIL/Build/Debug/../../ PackRat/source/tests/rb_testmain.rb:9:in `require' from /Users/rod/Development/Projects/infiniteNIL/Build/Debug/../../ PackRat/source/tests/rb_testmain.rb:9 If I uncomment the require 'osx/cocoa' then it works, except of course ns_import fails because it doesn't know the method. Anybody know why I'm getting this error? Thanks, Rod |