mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
New test
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10084 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
308519a677
commit
17b2315e80
1 changed files with 61 additions and 0 deletions
61
config/config.constant-string-class.m
Normal file
61
config/config.constant-string-class.m
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* Test that the compiler supports the -fconstant-string-class option
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Nicola Pero <nicola@brainstorm.co.uk>
|
||||
Created: June 2001
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
*/
|
||||
#ifdef NeXT_RUNTIME
|
||||
/* ignore this test with the NeXT runtime - never use
|
||||
-fconstant-string-class */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
abort ();
|
||||
return 1;
|
||||
}
|
||||
#else /* GNU RUNTIME - the real test */
|
||||
|
||||
/* must be compiled compile using -fconstant-string-class=NSConstantString
|
||||
as an option to gcc. If it doesn't work, it means your gcc doesn't
|
||||
support this option. */
|
||||
|
||||
#include <objc/objc.h>
|
||||
#include <objc/Object.h>
|
||||
|
||||
/* Define our custom constant string class */
|
||||
@interface NSConstantString : Object
|
||||
{
|
||||
char *c_string;
|
||||
unsigned int len;
|
||||
}
|
||||
- (char *) customString;
|
||||
@end
|
||||
|
||||
@implementation NSConstantString
|
||||
- (char *) customString
|
||||
{
|
||||
return c_string;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
/* Create a test constant string */
|
||||
NSConstantString *string = @"Antonio Valente";
|
||||
|
||||
/* Check that it really works */
|
||||
if (strcmp ([string customString], "Antonio Valente"))
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* GNU RUNTIME */
|
Loading…
Add table
Add a link
Reference in a new issue