On 13 Jan 2009, at 4:13 PM, Michael McCracken wrote:
> On Tue, Jan 13, 2009 at 8:19 AM, Gregory Jefferis
> <[email protected]> wrote:
>> Hello,
>>
>> I was trying to convert the remainder of Mike McCracken's unit tests.
>>
>> For TestComplexString, one of the tests looks like this:
>>
>> - (void)testStringFromBibTeXString{
>> BDSKStringNode *sn = [BDSKStringNode
>> nodeWithBibTeXString:@"{string}"];
>> // .. snip ..
>> UKStringsEqual(@"string", [sn value]);
>> }
>>
>>
>> And my new equivalent like this:
>>
>> - (void)testStringFromBibTeXString{
>> BDSKStringNode *sn = [BDSKStringNode
>> nodeWithQuotedString:@"{string}"];
>> STAssertEqualObjects(@"string", [sn value],nil);
>> }
>>
>> But this fails because [sn value] is unchanged ie @"{string}".
>> Looking at
>> the code, somewhere along the line the StringNode
>>
>> nodeWithQuotedString
>>
>> method stopped detexifying the string. I presume that's the correct
>> behaviour? Many thanks,
>
> I don't know what the correct behavior is here, but I can say that
> there are probably significant diversions between what my tests were
> testing back then and what the code should be doing now...
>
> BTW, this is really good - thanks for putting in the effort!
>
> -mike
>
>>
>> Greg.
>>
BibTeX string parsing has completely been moved into
BDSKComplexString. So for string nodes the input is the unquoted
string, not the bibtex string. The BDSKStringNode is now really
trivial, because there's not really anything going on in this class
anymore, it's just a container.
As for the ResolverMock in TestComplexString, you probably want to
pass [self macroResolver] and define:
- (BDSKMacroResolver *)macroResolver {
static BDSKMacroResolver *macroResolver = nil;
if (macroResolver == nil) {
macroResolver = [[BDSKMacroResolver alloc] initWithOwner:nil];
[macroResolver addMacroDefinition:@"expansion1"
forMacro:@"macro1"];
[macroResolver addMacroDefinition:@"expansion2"
forMacro:@"macro2"];
}
return macroResolver;
}
thanks!
Christiaan
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop