gnu-runtime-3.m: New test.
authorAndrew Pinski <pinskia@physics.uc.edu>
Fri, 25 Nov 2005 17:40:00 +0000 (17:40 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 25 Nov 2005 17:40:00 +0000 (09:40 -0800)
2005-11-25  Andrew Pinski  <pinskia@physics.uc.edu>

        * objc.dg/gnu-runtime-3.m: New test.

From-SVN: r107512

gcc/testsuite/ChangeLog
gcc/testsuite/objc.dg/gnu-runtime-3.m [new file with mode: 0644]

index 35d0b51b3bd8f047991c75b195d46a8a90744302..054ea9a27aa5e33394f5134292d8ca8f1a4f7cbe 100644 (file)
@@ -1,3 +1,7 @@
+2005-11-25  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       * objc.dg/gnu-runtime-3.m: New test.
+
 2005-11-25  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/9278
diff --git a/gcc/testsuite/objc.dg/gnu-runtime-3.m b/gcc/testsuite/objc.dg/gnu-runtime-3.m
new file mode 100644 (file)
index 0000000..09204e3
--- /dev/null
@@ -0,0 +1,30 @@
+/* Sanity check for GNU-runtime version of constant strings,
+   regardless of runtime used on target system.  */
+
+/* { dg-do run } */
+/* { dg-options "-fgnu-runtime" } */
+
+#include <objc/Object.h>
+#include <string.h>
+#include <stdlib.h>
+
+@interface NXConstantString: Object
+{
+  char *c_string;
+  unsigned int len;                                                     
+}
+-(const char *) cString;
+-(unsigned int) length;
+@end
+
+@implementation NXConstantString
+-(const char *) cString { return c_string; }
+-(unsigned int) length  { return len; }
+@end
+
+int main(int argc, void **args)
+{
+  if (strcmp ([@"this is a string" cString], "this is a string"))
+    abort ();
+  return 0;
+}