forked from MacRuby/MacRuby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
define -allocWithZone: and not -alloc on every new Ruby class
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/branches/experimental@1629 23306eb0-4c56-4727-a40e-e92c0eb68959
- Loading branch information
Showing
7 changed files
with
78 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require File.dirname(__FILE__) + "/../spec_helper" | ||
FixtureCompiler.require! "object" | ||
|
||
require File.join(FIXTURES, 'object') | ||
|
||
describe "A pure MacRuby Class" do | ||
=begin # TODO | ||
it "can be instantiated from Objective-C, using +[new]" do | ||
o = TestObject.testNewObject(TestObjectPureMacRuby) | ||
o.class.should == TestObjectPureMacRuby | ||
o.initialized?.should == true | ||
end | ||
=end | ||
|
||
it "can be instantiated from Objective-C, using +[alloc] and -[init]" do | ||
o = TestObject.testAllocInitObject(TestObjectPureMacRuby) | ||
o.class.should == TestObjectPureMacRuby | ||
o.initialized?.should == true | ||
end | ||
|
||
it "can be instantiated from Objective-C, using +[allocWithZone:] and -[init]" do | ||
o = TestObject.testAllocWithZoneInitObject(TestObjectPureMacRuby) | ||
o.class.should == TestObjectPureMacRuby | ||
o.initialized?.should == true | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
@interface TestObject : NSObject | ||
@end | ||
|
||
@implementation TestObject | ||
|
||
+ (id)testNewObject:(Class)k | ||
{ | ||
return [k new]; | ||
} | ||
|
||
+ (id)testAllocInitObject:(Class)k | ||
{ | ||
return [[k alloc] init]; | ||
} | ||
|
||
+ (id)testAllocWithZoneInitObject:(Class)k | ||
{ | ||
return [[k allocWithZone:NULL] init]; | ||
} | ||
|
||
@end | ||
|
||
void Init_object(void) {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class TestObjectPureMacRuby | ||
def initialize | ||
@initialized = true | ||
end | ||
def initialized?; @initialized; end | ||
end |