Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/bf9adb0cf9a7964005f3cc8ff2620cc046eceddd

>---------------------------------------------------------------

commit bf9adb0cf9a7964005f3cc8ff2620cc046eceddd
Author: Peter Wortmann <[email protected]>
Date:   Fri Apr 22 10:45:09 2011 +0100

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

>---------------------------------------------------------------

 driver/testglobals.py                              |    7 ++++---
 driver/testlib.py                                  |    5 +++++
 tests/driver/objc/all.T                            |    3 +++
 .../driver/objc/objcpp-hi.mm}                      |    4 ++--
 .../driver/objc/objcpp-hi.stdout}                  |    0 
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/driver/testglobals.py b/driver/testglobals.py
index 0e4ab05..9bcdcba 100644
--- a/driver/testglobals.py
+++ b/driver/testglobals.py
@@ -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
diff --git a/driver/testlib.py b/driver/testlib.py
index 5b64539..56ce263 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -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:
diff --git a/tests/driver/objc/all.T b/tests/driver/objc/all.T
index ee22934..eb472a4 100644
--- a/tests/driver/objc/all.T
+++ b/tests/driver/objc/all.T
@@ -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++'])
diff --git a/tests/driver/objc/objc-hi.m 
b/tests/ghc-regress/driver/objc/objcpp-hi.mm
similarity index 88%
copy from tests/driver/objc/objc-hi.m
copy to tests/ghc-regress/driver/objc/objcpp-hi.mm
index 4580bd2..7a4f101 100644
--- a/tests/driver/objc/objc-hi.m
+++ b/tests/ghc-regress/driver/objc/objcpp-hi.mm
@@ -1,5 +1,5 @@
 #import <Foundation/Foundation.h>
-#import <stdio.h> 
+#import <iostream>
 
 @interface HelloWorld : NSObject {
   // no instance variables
@@ -14,7 +14,7 @@
 
 - (void)sayHello
 {
-  printf("Hello world\n");
+  std::cout << "Hello world" << std::endl;
 }
 
 @end
diff --git a/tests/driver/objc/objc-hi.stdout 
b/tests/ghc-regress/driver/objc/objcpp-hi.stdout
similarity index 100%
copy from tests/driver/objc/objc-hi.stdout
copy to tests/ghc-regress/driver/objc/objcpp-hi.stdout



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to