Hi Adam
On 2009-01-19 00:39, "Adam R. Maxwell" <amaxw...@mac.com> wrote: > So is anyone else seeing these failures in the unit tests? My guess > is that this is due to author normalization preferences (I save with > normalized names). No. But you're right about the normalised names pref - that's why. It does actually bring up a general issue that I had been wondering about. Is there anyway to disable user preferences during the unit tests? We don't really want to use any of our personal prefs. We could obviously remove this test, but it's otherwise perfectly sensible and it may not be worth breaking it down into subtests. We could also add some logic to the unit test that checks the BDSKShouldSaveNormalizedAuthorNamesKey and adjusts the test accordingly, but that's going to be a pain. Finally, we could change the pref before running the test. I don't think this changes any user preferences, but it could be unset and reset (as below) for tidiness. Thoughts? Best, Greg diff --git a/bibdesk/UnitTests/TestBDSKRISParser.m b/bibdesk/UnitTests/TestBDSKRISParser.m index 0df1669..82e2b6a 100644 --- a/bibdesk/UnitTests/TestBDSKRISParser.m +++ b/bibdesk/UnitTests/TestBDSKRISParser.m @@ -69,6 +69,10 @@ static NSString *badRISSingleSpace = @"TY - JOUR\nT1 - Julian Steward, American BibItem *b2 = [[BDSKStringParser itemsFromString:goodRISNoFinalReturnOrSpace ofType:BDSKUnknownStringType error:NULL] lastObject]; // These are fairly broad spectrum tests - would probably be better to break it down some more. + // Turn off the normalised author setting if it is ON. Otherwise we should have: + // Author = {Pinkoski, Mark} + BOOL authorNormalization = [[OFPreferenceWrapper sharedPreferenceWrapper] boolForKey:BDSKShouldSaveNormalizedAuthorNamesKey]; + [[OFPreferenceWrapper sharedPreferenceWrapper] setBool:NO forKey:BDSKShouldSaveNormalizedAuthorNamesKey]; STAssertEqualObjects([b bibTeXStringWithOptions:BDSKBibTeXOptionDropInternalMask], @"@article{cite-key,\n\tAuthor = {Marc Pinkoski},\n\tJournal = {Histories of Anthropology Annual},\n\tPages = {172--204},\ @@ -76,6 +80,7 @@ static NSString *badRISSingleSpace = @"TY - JOUR\nT1 - Julian Steward, American STAssertEqualObjects([b2 bibTeXStringWithOptions:BDSKBibTeXOptionDropInternalMask], @"@article{cite-key,\n\tAuthor = {Marc Pinkoski},\n\tJournal = {Histories of Anthropology Annual},\n\tPages = {172--204},\ @"BibTex format error for RIS record, Pinkoski 2008"); + [[OFPreferenceWrapper sharedPreferenceWrapper] setBool:authorNormalization forKey:BDSKShouldSaveNormalizedAuthorNamesKey]; } @end ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop