mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Added some exception tests
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10943 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
94d68001bd
commit
f9dcbd7dbe
4 changed files with 64 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-09-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Testing/nsconnection_client.m: Added simple exception tests
|
||||
* Testing/nsconnection_server.m: Added simple exception tests
|
||||
* Testing/server.h: Added simple exception tests
|
||||
|
||||
2001-09-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSConnection.m: rewrite ethod call code.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <assert.h>
|
||||
#include "server.h"
|
||||
|
||||
|
@ -202,6 +203,42 @@ con_messages (id prx)
|
|||
[prx shout];
|
||||
printf(" ok\n");
|
||||
|
||||
printf("Testing exception in method with return value:\n");
|
||||
NS_DURING
|
||||
{
|
||||
[prx exceptionTest1];
|
||||
printf(" ERROR\n");
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
printf(" ok ... %s\n", [[localException description] cString]);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
printf("Testing exception in method with void return:\n");
|
||||
NS_DURING
|
||||
{
|
||||
[prx exceptionTest2];
|
||||
printf(" ERROR\n");
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
printf(" ok ... %s\n", [[localException description] cString]);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
printf("Testing exception in oneway void method:\n");
|
||||
NS_DURING
|
||||
{
|
||||
[prx exceptionTest3];
|
||||
printf(" ok\n");
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
printf(" ERROR ... %s\n", [[localException description] cString]);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
/* this next line doesn't actually test callbacks, it tests
|
||||
sending the same object twice in the same message. */
|
||||
printf("Send same object twice in message\n");
|
||||
|
@ -223,6 +260,7 @@ con_messages (id prx)
|
|||
[prx sendByref:[NSDate date]];
|
||||
#endif
|
||||
printf(" ok\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include "server.h"
|
||||
|
||||
#include "wgetopt.h"
|
||||
|
@ -65,6 +66,22 @@
|
|||
return obj;
|
||||
}
|
||||
|
||||
- (int) exceptionTest1
|
||||
{
|
||||
[NSException raise: @"Test1" format: @"exception1"];
|
||||
return 111;
|
||||
}
|
||||
|
||||
- (void) exceptionTest2
|
||||
{
|
||||
[NSException raise: @"Test2" format: @"exception2"];
|
||||
}
|
||||
|
||||
- (void) exceptionTest3
|
||||
{
|
||||
[NSException raise: @"Test3" format: @"exception3"];
|
||||
}
|
||||
|
||||
- print: (const char *)msg
|
||||
{
|
||||
printf(">>%s<<\n", msg);
|
||||
|
|
|
@ -67,6 +67,9 @@ struct myarray {
|
|||
#endif
|
||||
- manyArgs: (int)i1 : (int)i2 : (int)i3 : (int)i4 : (int)i5 : (int)i6
|
||||
: (int)i7 : (int)i8 : (int)i9 : (int)i10 : (int)i11 : (int)i12;
|
||||
- (int) exceptionTest1;
|
||||
- (void) exceptionTest2;
|
||||
- (oneway void) exceptionTest3;
|
||||
@end
|
||||
|
||||
@interface Server : NSObject <ServerProtocol>
|
||||
|
|
Loading…
Reference in a new issue