diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-06 10:04:54 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-03-06 10:04:54 +0000 |
commit | b7de7b7a3a8fce76ede3aaf95f3a4416d10a0330 (patch) | |
tree | c7b3a28a926f9e64d20cdaac03ad76793baa4910 /gcc/testsuite/objc | |
parent | 012f1707dcb2b3346ef763cbbb38213d617f6fce (diff) | |
download | gcc-b7de7b7a3a8fce76ede3aaf95f3a4416d10a0330.tar.gz |
* objc/objc-act.c (objc_add_static_instance): Set DECL_INITIAL
and DECL_DEFER_OUTPUT on the decl we create, before calling
rest_of_decl_compilation.
testsuite:
* objc/execute/string1.m, objc/execute/string2.m: Compare the
result of -cString against what we expect it to be; don't just
print it out for no one to read.
* objc/execute/string3.m, objc/execute/string4.m: New tests.
Based on testcases provided by Nicola Pero.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40261 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc')
-rw-r--r-- | gcc/testsuite/objc/execute/string1.m | 8 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string2.m | 9 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string3.m | 14 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string4.m | 12 |
4 files changed, 39 insertions, 4 deletions
diff --git a/gcc/testsuite/objc/execute/string1.m b/gcc/testsuite/objc/execute/string1.m index f0d14731836..fff03c7cfa6 100644 --- a/gcc/testsuite/objc/execute/string1.m +++ b/gcc/testsuite/objc/execute/string1.m @@ -1,8 +1,12 @@ -#include <stdio.h> +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> #include <objc/NXConstStr.h> int main(int argc, void **args) { - printf ([@"this is a string\n" cString]); + if (strcmp ([@"this is a string" cString], "this is a string")) + abort (); return 0; } diff --git a/gcc/testsuite/objc/execute/string2.m b/gcc/testsuite/objc/execute/string2.m index 247e22bc3d6..66462b3c96c 100644 --- a/gcc/testsuite/objc/execute/string2.m +++ b/gcc/testsuite/objc/execute/string2.m @@ -1,8 +1,13 @@ -#include <stdio.h> +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> #include <objc/NXConstStr.h> int main(int argc, void **args) { - printf ([@"this " @"is " @"a " @"string\n" cString]); + if (strcmp ([@"this " @"is " @"a " @"string" cString], + "this " "is " "a " "string")) + abort (); return 0; } diff --git a/gcc/testsuite/objc/execute/string3.m b/gcc/testsuite/objc/execute/string3.m new file mode 100644 index 00000000000..21527dcbf15 --- /dev/null +++ b/gcc/testsuite/objc/execute/string3.m @@ -0,0 +1,14 @@ +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> +#include <objc/NXConstStr.h> + +#define STRING "this is a string" + +int main (int argc, void **args) +{ + if (strcmp ([@STRING cString], STRING)) + abort (); + return 0; +} diff --git a/gcc/testsuite/objc/execute/string4.m b/gcc/testsuite/objc/execute/string4.m new file mode 100644 index 00000000000..54550d6f5e9 --- /dev/null +++ b/gcc/testsuite/objc/execute/string4.m @@ -0,0 +1,12 @@ +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> +#include <objc/NXConstStr.h> + +int main(int argc, void **args) +{ + if ([@"this is a string" length] != strlen ("this is a string")) + abort (); + return 0; +} |