OCUnit unit tests and user defaults...
OCUnit unit tests and user defaults...
- Subject: OCUnit unit tests and user defaults...
- From: Jiva DeVoe <email@hidden>
- Date: Sun, 8 Jan 2006 11:37:21 -0500
This code:
-(void)setUp;
{
NSMutableDictionary *defaultValues = [NSMutableDictionary
dictionary];
[defaultValues setObject:@"blah" forKey:@"FOO"];
[[NSUserDefaults standardUserDefaults]
registerDefaults:defaultValues];
NSLog(@"blahblah");
}
-(void)testSomething
{
shouldBeEqual([[NSUserDefaults standardUserDefaults]
stringForKey:@"FOO"], @"FOO");
}
Yields:
2006-01-08 11:33:20.912 TestApp[13942] blahblah
/Volumes/Home/Users/jiva/Projects/TestApp/UserDefaultsTest.mm:25: -
[UserDefaultsTest testSomething] : '(null)' should be equal to 'FOO'
Does the same if I put it in +initialize and various other places...
what's the deal? Can I not use userdefaults as I normally would when
using unit tests?
Can someone shed some light on why this doesn't work?
I'm thinking it's because OCUnit does weird things with it's otest
tool etc... if so... is there some way I can force it to work
without hacking up my non-test code?
--
Jiva DeVoe
http://www.devoesquared.com
PowerCard - Intuitive Project Management for Mac OS X
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden