From: Eloy D. <e....@su...> - 2008-03-04 16:17:41
|
Hi Rod, Not sure where the overriding of #chomp happens and/or that's supposed to happen...? But anyways, if you want to be able to override stuff without RC complaining about the arity you should do the following somewhere before you start your tests: def OSX._ignore_ns_override; true; end Cheers, Eloy On Mar 4, 2008, at 8:04 AM, Rod Schmidt wrote: > 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 > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk |