Added trivbial test

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20496 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-12-28 10:54:33 +00:00
parent 3e866ab068
commit 0de118ae76
3 changed files with 46 additions and 0 deletions

View file

@ -2,6 +2,7 @@
* Tools/gdnc.m: Change name of dummy class to avoid Darwin linker
problems.
* Testing/nsundomanager.m: Trivial test added
2004-12-21 Adam Fedor <fedor@gnu.org>

View file

@ -63,6 +63,7 @@ CHECKABLE_TOOLS = \
nstask \
nstimer \
nstimezone \
nsundomanager \
nsxmlparser \
release \
string \
@ -121,6 +122,7 @@ nstask_OBJC_FILES = nstask.m
nstimer_OBJC_FILES = nstimer.m
nstimezone_OBJC_FILES = nstimezone.m
nsxmlparser_OBJC_FILES = nsxmlparser.m
nsundomanager_OBJC_FILES = nsundomanager.m
prepend_OBJC_FILES = prepend.m
release_OBJC_FILES = release.m
string_OBJC_FILES = string.m

43
Testing/nsundomanager.m Normal file
View file

@ -0,0 +1,43 @@
#include <Foundation/Foundation.h>
@interface UndoObject: NSObject
{
int state;
}
- (void) setState: (int)aState;
- (int) state;
@end
@implementation UndoObject
- (void) setState: (int)aState
{
state = aState;
}
- (int) state
{
return state;
}
@end
int
main ()
{
CREATE_AUTORELEASE_POOL(arp);
NSUndoManager *u = [NSUndoManager new];
UndoObject *o = [UndoObject new];
BOOL failed = NO;
[u registerUndoWithTarget: o selector: @selector(setState:) object: (id)1];
[u undo];
if ([o state] != 1)
{
NSLog(@"Failed undo");
failed = YES;
}
RELEASE(arp);
if (failed == NO)
{
NSLog(@"Test passed");
}
exit (0);
}