diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/type-stream-1.m | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c849daa..d9a5e53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-09-04 Andrew Pinski <pinskia@physics.uc.edu> + Rasmus Hahn <rassahah@neofonie.de> + + PR libobjc/23108 + * objc.dg/type-stream-1.m: New test. + 2005-09-04 Tobias Schl"uter <tobias.shclueter@physik.uni-muenchen.de> PR fortran/23661 diff --git a/gcc/testsuite/objc.dg/type-stream-1.m b/gcc/testsuite/objc.dg/type-stream-1.m new file mode 100644 index 0000000..edc04e6 --- /dev/null +++ b/gcc/testsuite/objc.dg/type-stream-1.m @@ -0,0 +1,25 @@ +/* { dg-options "-fgnu-runtime" } */ +/* { dg-do run } */ +#include <objc/typedstream.h> +#include <stdio.h> +#include <stdlib.h> + +int main (void) +{ + FILE *f; TypedStream *ts; + struct T { int a, b; } x = { 1, 2 }; + f = fopen ("foo", "w"); ts = objc_open_typed_stream (f, OBJC_WRITEONLY); + objc_write_type (ts, @encode(struct T), &x); + objc_close_typed_stream (ts); fclose (f); + f = fopen ("foo", "r"); ts = objc_open_typed_stream (f, OBJC_READONLY); + struct T y; + objc_read_type (ts, @encode(struct T), &y); + if (y.a != 1) + abort (); + if (y.b != 2) + abort (); + objc_close_typed_stream (ts); fclose (f); + remove ("foo"); + return 0; +} + |