Adium

Changeset 24470

Show
Ignore:
Timestamp:
07/21/2008 07:47:48 PM (6 months ago)
Author:
sholt
Message:

Unit test for 2 URI's seperated by some text. Refs #10532.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/AutoHyperlinks Framework/UnitTests/HyperlinkContextTest.h

    r23860 r24470  
    1414- (void)testJID; 
    1515- (void)testEdgeURI; 
     16- (void)testCompositContext; 
    1617@end 
  • trunk/Frameworks/AutoHyperlinks Framework/UnitTests/HyperlinkContextTest.m

    r24390 r24470  
    4343        [self testLaxContext:format withURI:URIString]; 
    4444} 
     45 
    4546- (void)testEnclosedURIFollowedByCharacter:(NSString *)URIString { 
    4647        enum { 
     
    211212        [self testLaxContext:@"l<><><><><<<<><><><><%@><><><><><><<<><><><><><>" withURI:@"http://example.com/foo_(bar)"]; 
    212213         
    213         [self testLaxContext:@"@example.com" withURI:@"example.com"]; 
    214          
    215         [self testLaxContext:@"foo (bar) http://example.com/path/to/url.html" withURI:@"http://example.com/path/to/url.html"]; 
     214        [self testLaxContext:@"@%@" withURI:@"example.com"]; 
     215         
     216        [self testLaxContext:@"foo (bar) %@" withURI:@"http://example.com/path/to/url.html"]; 
     217
     218 
     219- (void)testCompositContext { 
     220        NSString                        *URI1 = @"mailto:test@example.com"; 
     221        NSString                        *URI2 = @"xmpp:test@example.com"; 
     222        NSString                        *testString = [NSString stringWithFormat:@"%@ something %@", URI1, URI2]; 
     223        AHHyperlinkScanner      *scanner = [AHHyperlinkScanner hyperlinkScannerWithString:testString]; 
     224        AHMarkedHyperlink       *link; 
     225         
     226        link = [scanner nextURI]; 
     227        STAssertNotNil(link, @"-[SHHyperlinkScanner nextURL] found no URI in \"%@\"", testString); 
     228        STAssertEqualObjects([[link parentString] substringWithRange:[link range]], URI1, @"in context: '%@'", testString); 
     229         
     230        link = [scanner nextURI]; 
     231        STAssertNotNil(link, @"-[SHHyperlinkScanner nextURL] found no URI in \"%@\"", testString); 
     232        STAssertEqualObjects([[link parentString] substringWithRange:[link range]], URI2, @"in context: '%@'", testString); 
    216233} 
    217234@end