diff --git a/test/test/spec/block_spec.rb b/test/test/spec/block_spec.rb index 92f2ed7f..c86dd450 100644 --- a/test/test/spec/block_spec.rb +++ b/test/test/spec/block_spec.rb @@ -334,3 +334,11 @@ describe "Proc#owner" do b.owner.should == self end end + +describe "C-Blocks" do + # RM-502 + it "should not crash when ObjC method return nil instead of C-Blocks" do + obj = TestBlocks.new + obj.map.should == nil + end +end diff --git a/test/test/vendor/code/blocks.h b/test/test/vendor/code/blocks.h new file mode 100644 index 00000000..2f5d76ba --- /dev/null +++ b/test/test/vendor/code/blocks.h @@ -0,0 +1,12 @@ +#import "Availability.h" + +#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED +#import +#else +#import +#endif + +@interface TestBlocks : NSObject +typedef void (^SampleBlock)(NSString* string); +- (SampleBlock)map; +@end diff --git a/test/test/vendor/code/blocks.m b/test/test/vendor/code/blocks.m new file mode 100644 index 00000000..ff522726 --- /dev/null +++ b/test/test/vendor/code/blocks.m @@ -0,0 +1,9 @@ +#include "blocks.h" + +@implementation TestBlocks +- (SampleBlock)map +{ + return nil; +} + +@end