Commit 692bfea4 authored by Austin Seipp's avatar Austin Seipp

Tests for trac #5025.

Also teach the testsuite how to compile objective-c code with .m as
a suffix.
parent 30e6a449
......@@ -199,8 +199,9 @@ class TestOptions:
# Does this test use a literate (.lhs) file?
self.literate = 0
# Does this test use a .c file?
self.c_src = 0
# Does this test use a .c or .m file?
self.c_src = 0
self.objc_src = 0
# Command to run before the test
self.pre_cmd = None
......
......@@ -369,6 +369,9 @@ def literate( opts ):
def c_src( opts ):
opts.c_src = 1;
def objc_src( opts ):
opts.objc_src = 1;
# ----
def pre_cmd( cmd ):
......@@ -1451,6 +1454,8 @@ def add_suffix( name, suffix ):
def add_hs_lhs_suffix(name):
if getTestOpts().c_src:
return add_suffix(name, 'c')
elif getTestOpts().objc_src:
return add_suffix(name, 'm')
elif getTestOpts().literate:
return add_suffix(name, 'lhs')
else:
......
def if_not_platform(platforms, f):
if not (config.platform in platforms):
return f
else:
return normal
skip_if_not_osx = if_not_platform(['i386-apple-darwin','x86_64-apple-darwin'], skip)
test('objc-hi', [ skip_if_not_osx, objc_src ], compile_and_run, ['-framework Foundation'])
#import <Foundation/Foundation.h>
#import <stdio.h>
@interface HelloWorld : NSObject {
// no instance variables
}
// methods
- (void)sayHello;
@end
@implementation HelloWorld
- (void)sayHello
{
printf("Hello world\n");
}
@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