Changeset 375 for trunk/ICeCoffEE/ICeCoffEE/TestParser.m
- Timestamp:
- 02/10/08 06:02:25 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/TestParser.m
r373 r375 15 15 return [NSString stringWithFormat: @"%@ (%d)", context, (int)err]; 16 16 } 17 18 void ICCF_CheckRange(NSRange range) {} 17 19 18 20 void ps(NSString *format, ...) { … … 65 67 } 66 68 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; 83 105 } 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;103 106 } 107 108 summary: 109 ps(@"PASS %d FAIL %d", pass, fail); 104 110 105 111 ICCF_StopIC();
Note:
See TracChangeset
for help on using the changeset viewer.