• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
OCUnit unit tests and user defaults...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: OCUnit unit tests and user defaults...
      • From: Daniel Jalkut <email@hidden>
  • Prev by Date: Newbie cuestion on document based app and menus
  • Next by Date: Re: -observeValueForKeyPath:ofObject:change:context: only, > defined for abstract class.
  • Previous by thread: Re: Newbie cuestion on document based app and menus
  • Next by thread: Re: OCUnit unit tests and user defaults...
  • Index(es):
    • Date
    • Thread