[macruby-changes] [304] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jun 23 13:51:19 PDT 2008
Revision: 304
http://trac.macosforge.org/projects/ruby/changeset/304
Author: eloy.de.enige at gmail.com
Date: 2008-06-23 13:51:19 -0700 (Mon, 23 Jun 2008)
Log Message:
-----------
Did some cleaning and polishing.
Modified Paths:
--------------
MacRuby/trunk/lib/osx/rubycocoa.rb
MacRuby/trunk/test-macruby/rubycocoa_test.rb
Modified: MacRuby/trunk/lib/osx/rubycocoa.rb
===================================================================
--- MacRuby/trunk/lib/osx/rubycocoa.rb 2008-06-23 20:18:41 UTC (rev 303)
+++ MacRuby/trunk/lib/osx/rubycocoa.rb 2008-06-23 20:51:19 UTC (rev 304)
@@ -31,16 +31,6 @@
end
end
- #alias_method :__init_added_before_rubycocoa_layer, :init
- # def init
- # #if __init_added_before_rubycocoa_layer
- # # p self
- # # p initialize
- # initialize
- # self
- # #end
- # end
-
def objc_send(*args)
if args.length > 1
selector, new_args = '', []
Modified: MacRuby/trunk/test-macruby/rubycocoa_test.rb
===================================================================
--- MacRuby/trunk/test-macruby/rubycocoa_test.rb 2008-06-23 20:18:41 UTC (rev 303)
+++ MacRuby/trunk/test-macruby/rubycocoa_test.rb 2008-06-23 20:51:19 UTC (rev 304)
@@ -2,6 +2,8 @@
require "test/spec"
require 'mocha'
+
+#require File.expand_path('../../lib/osx/rubycocoa', __FILE__)
require 'osx/cocoa'
class TestRubyCocoaStyleMethod < OSX::NSObject
@@ -20,6 +22,9 @@
def method_rubyCocoaStyle_withExtraArg(mname, rc_style, arg)
"#{mname}(#{rc_style}, #{arg})"
end
+
+ def method_notRubyCocoaStyle(first_arg, second_arg, third_arg)
+ end
end
class TestRubyCocoaStyleSuperMethod < OSX::NSObject
@@ -39,15 +44,11 @@
CONSTANT_IN_THE_TOPLEVEL_OBJECT_INSTEAD_OF_OSX = true
describe "RubyCocoa layer, in general" do
- xit "should load AppKit when the osx/cocoa file is loaded" do
+ it "should load AppKit when the osx/cocoa file is loaded" do
Kernel.expects(:framework).with('AppKit')
load 'osx/cocoa.rb'
end
- it "should still raise a RuntimeError" do
- lambda { Kernel.framework 'Foo' }.should.raise RuntimeError
- end
-
it "should set a global variable which indicates that a framework is being loaded" do
Kernel.expects(:__framework_before_rubycocoa_layer).with do |f|
$LOADING_FRAMEWORK.should.be true
@@ -72,7 +73,7 @@
NSObjectSubclassWithoutInitialize.alloc.init.instance_variable_get(:@set_from_initialize).should.be nil
end
- it "should catch RubyCocoa style method names, call the correct method and define a shortcut method" do
+ it "should catch RubyCocoa style method names, call the correct MacRuby style method and define a shortcut method" do
@obj.perform_selector_with_object('description', nil).should.match /^<TestRubyCocoaStyleMethod/
@obj.respond_to?(:callMethod_withArgs).should.be true
@obj.perform_selector_with_object('description', nil).should.match /^<TestRubyCocoaStyleMethod/
@@ -89,13 +90,13 @@
nsstring.should == 'foobar'
end
- it "should still raise a NoMethodError if the selector doesn't exist (or rather call the previous implementation)" do
+ it "should still raise a NoMethodError if the selector doesn't exist when a method is missing" do
lambda { @obj.does_not_exist }.should.raise NoMethodError
lambda { @obj.doesnotexist_ }.should.raise NoMethodError
lambda { @obj.doesnotexist }.should.raise NoMethodError
end
- it "should be possible to call super methods" do
+ it "should be possible to call super_foo type methods" do
lambda { TestRubyCocoaStyleSuperMethod.alloc.init }.should.not.raise.exception
end
@@ -111,6 +112,10 @@
@obj.respond_to?(:"method:rubyCocoaStyle:withExtraArg:").should.be true
@obj.method('foo', rubyCocoaStyle:true, withExtraArg:false).should == 'foo(true, false)'
end
+
+ it "should not create MacRuby style method aliases for methods containing underscores if the arity doesn't match" do
+ @obj.respond_to?(:"method:notRubyCocoaStyle:").should.be false
+ end
end
describe 'OSX module' do
@@ -139,7 +144,7 @@
OSX::CONSTANT_IN_THE_TOPLEVEL_OBJECT_INSTEAD_OF_OSX.should.be true
end
- it "should still raise a NameError from OSX not the toplevel object" do
+ it "should still raise a NameError from OSX, not from the toplevel object, when a constant is missing" do
lambda { OSX::DOES_NOT_EXIST_IN_TOPLEVEL_OBJECT }.should.raise NameError
begin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080623/2fcc8b20/attachment.htm
More information about the macruby-changes
mailing list