Ignore:
Timestamp:
02/10/08 06:02:25 (16 years ago)
Author:
Nicholas Riley
Message:

ICeCoffEE.[hm]: Restore ICCF_CheckRange, moved in [322], as we don't
want the range limited in TestParser.

ICeCoffEEParser.m: Remove ICCF_CheckRange. Comment out expandFront
URL/parens stuff; it's as yet untested. Handle {...} in URLs. Don't
assert when )/} is last character in string. Fix indentation.

ICeCoffEE.xcodeproj: Link TestParser to Cocoa normally. Remove
obsolete build settings.

TestParser.m: Stub out ICCF_CheckRange. Test beginning with
one-character ranges all the way through the string. Output summary
stats at end.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/TestParser.m

    r373 r375  
    1515    return [NSString stringWithFormat: @"%@ (%d)", context, (int)err];
    1616}
     17
     18void ICCF_CheckRange(NSRange range) {}
    1719
    1820void ps(NSString *format, ...) {
     
    6567        }
    6668       
    67         // XXX can't yet select by word, so just try a middle-ish character
    68         NSRange initialSelectionRange = {
    69             delimitedURIRange.location + (delimitedURIRange.length / 2),
    70             delimitedURIRange.length != 0
    71         };
    72        
    73         // XXX figure XFAIL-type error checking
    74        
    75         NSRange enclosingRange;
    76         NSString *parsedURI = nil;
    77         NSException *parseException = nil;
    78         @try {
    79             enclosingRange = ICCF_URLEnclosingRange(text, delimitedURIRange);
    80             parsedURI = [text substringWithRange: enclosingRange];
    81         } @catch (NSException *e) {
    82             parseException = e;
     69        for (unsigned startOffset = 0 ; startOffset < delimitedURIRange.length ; ++startOffset) {
     70            NSRange initialSelectionRange = {
     71                delimitedURIRange.location + startOffset,
     72                delimitedURIRange.length != 0
     73            };
     74           
     75            // XXX figure XFAIL-type error checking
     76           
     77            NSRange enclosingRange;
     78            NSString *parsedURI = nil;
     79            NSException *parseException = nil;
     80            @try {
     81                enclosingRange = ICCF_URLEnclosingRange(text, delimitedURIRange);
     82                parsedURI = [text substringWithRange: enclosingRange];
     83            } @catch (NSException *e) {
     84                parseException = e;
     85            }
     86           
     87            if ([uri isEqualToString: parsedURI]) {
     88                ++pass;
     89                continue;
     90            }
     91           
     92            ps(@"Text       %@", text);
     93            pr(@"Available ", delimitedURIRange);
     94            pr(@"Starting  ", initialSelectionRange);
     95           
     96            if (parseException != nil) {
     97                ps(@"Exception  %@", parseException);
     98            } else {
     99                pr(@"Parsed    ", enclosingRange);
     100                ps(@"Parsed     %@", parsedURI);
     101                ps(@"Desired    %@", uri);
     102            }
     103            ++fail;
     104            goto summary;
    83105        }
    84 
    85         if ([uri isEqualToString: parsedURI]) {
    86             ++pass;
    87             continue;
    88         }
    89            
    90         ps(@"Text       %@", text);
    91         pr(@"Available ", delimitedURIRange);
    92         pr(@"Starting  ", initialSelectionRange);
    93 
    94         if (parseException != nil) {
    95             ps(@"Exception  %@", parseException);
    96             continue;
    97         }
    98 
    99         pr(@"Parsed    ", enclosingRange);
    100         ps(@"Parsed     %@", parsedURI);
    101         ps(@"Desired    %@", uri);
    102         ++fail;
    103106    }
     107   
     108summary:
     109    ps(@"PASS %d FAIL %d", pass, fail);
    104110   
    105111    ICCF_StopIC();
Note: See TracChangeset for help on using the changeset viewer.