Commit 5b5294f4 authored by Peter Wortmann's avatar Peter Wortmann Committed by Ian Lynagh
Browse files

Testcase for objective-c++ compilation (trac #5150)

parent e2520305
......@@ -202,9 +202,10 @@ class TestOptions:
# Does this test use a literate (.lhs) file?
self.literate = 0
# Does this test use a .c or .m file?
self.c_src = 0
self.objc_src = 0
# Does this test use a .c, .m or .mm file?
self.c_src = 0
self.objc_src = 0
self.objcpp_src = 0
# Command to run before the test
self.pre_cmd = None
......
......@@ -388,6 +388,9 @@ def c_src( opts ):
def objc_src( opts ):
opts.objc_src = 1;
def objcpp_src( opts ):
opts.objcpp_src = 1;
# ----
def pre_cmd( cmd ):
......@@ -1581,6 +1584,8 @@ def add_hs_lhs_suffix(name):
return add_suffix(name, 'c')
elif getTestOpts().objc_src:
return add_suffix(name, 'm')
elif getTestOpts().objcpp_src:
return add_suffix(name, 'mm')
elif getTestOpts().literate:
return add_suffix(name, 'lhs')
else:
......
......@@ -8,3 +8,6 @@ skip_if_not_osx = if_not_platform(['i386-apple-darwin','x86_64-apple-darwin'], s
test('objc-hi', [ skip_if_not_osx, objc_src ],
compile_and_run, ['-framework Foundation'])
test('objcpp-hi', [ skip_if_not_osx, objcpp_src ],
compile_and_run, ['-framework Foundation -lstdc++'])
#import <Foundation/Foundation.h>
#import <iostream>
@interface HelloWorld : NSObject {
// no instance variables
}
// methods
- (void)sayHello;
@end
@implementation HelloWorld
- (void)sayHello
{
std::cout << "Hello world" << std::endl;
}
@end
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// my stuff
HelloWorld *hw = [[HelloWorld alloc] init];
[hw autorelease];
[hw sayHello];
[pool release];
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment