Skip to content

Commit

Permalink
Unit tests...
Browse files Browse the repository at this point in the history
  • Loading branch information
macmade committed Jun 23, 2015
1 parent 50db7a2 commit 989ab31
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions UTI Tests/UTITest.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - ( void )test_preferredNSPboardType
uti = [ UTI vCardTypeUTI ];

XCTAssertNotNil( uti );
XCTAssertEqualObjects( uti.preferredNSPboardType, @"Apple VCard pasteboard type" );
XCTAssertEqualObjects( uti.preferredNSPboardType, NSVCardPboardType );
}

- ( void )test_preferredOSType
Expand Down Expand Up @@ -227,7 +227,7 @@ - ( void )test_UTIWithFileExtension_allowDynamic
XCTAssertTrue( uti.isDynamic );
}

- ( void )test_UTIWithFileExtension_ConformingTo
- ( void )test_UTIWithFileExtension_conformingTo
{
UTI * uti;

Expand Down Expand Up @@ -264,7 +264,7 @@ - ( void )test_UTIWithMIMEType_allowDynamic
XCTAssertTrue( uti.isDynamic );
}

- ( void )test_UTIWithMIMEType_ConformingTo
- ( void )test_UTIWithMIMEType_conformingTo
{
UTI * uti;

Expand All @@ -281,7 +281,7 @@ - ( void )test_UTIWithNSPboardType
{
UTI * uti;

uti = [ UTI UTIWithNSPboardType: @"Apple VCard pasteboard type" ];
uti = [ UTI UTIWithNSPboardType: NSVCardPboardType ];

XCTAssertNotNil( uti );
XCTAssertTrue( [ uti isEqualToUTI: [ UTI vCardTypeUTI ] ] );
Expand All @@ -301,15 +301,15 @@ - ( void )test_UTIWithNSPboardType_allowDynamic
XCTAssertTrue( uti.isDynamic );
}

- ( void )test_UTIWithNSPboardType_ConformingTo
- ( void )test_UTIWithNSPboardType_conformingTo
{
UTI * uti;

uti = [ UTI UTIWithNSPboardType: @"Apple VCard pasteboard type" conformingTo: [ UTI textTypeUTI ] ];
uti = [ UTI UTIWithNSPboardType: NSVCardPboardType conformingTo: [ UTI textTypeUTI ] ];

XCTAssertNotNil( uti );

uti = [ UTI UTIWithNSPboardType: @"Apple VCard pasteboard type" conformingTo: [ UTI imageTypeUTI ] ];
uti = [ UTI UTIWithNSPboardType: NSVCardPboardType conformingTo: [ UTI imageTypeUTI ] ];

XCTAssertNil( uti );
}
Expand Down Expand Up @@ -338,7 +338,7 @@ - ( void )test_UTIWithOSType_allowDynamic
XCTAssertTrue( uti.isDynamic );
}

- ( void )test_UTIWithOSType_ConformingTo
- ( void )test_UTIWithOSType_conformingTo
{
UTI * uti;

Expand Down Expand Up @@ -1140,7 +1140,7 @@ - ( void )test_allUTIsWithFileExtension_allowDynamic
XCTAssertEqual( [ UTI allUTIsWithFileExtension: @"xyz" allowDynamic: NO ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithFileExtension_ConformingTo
- ( void )test_allUTIsWithFileExtension_conformingTo
{
XCTAssertGreaterThan( [ UTI allUTIsWithFileExtension: @"mp4" conformingTo: [ UTI audioTypeUTI ] ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithFileExtension: @"mp4" conformingTo: [ UTI textTypeUTI ] ].count, ( NSUInteger )0 );
Expand All @@ -1158,40 +1158,46 @@ - ( void )test_AllUTIsWithMIMEType_allowDynamic
XCTAssertEqual( [ UTI allUTIsWithMIMEType: @"xyz/xyz" allowDynamic: NO ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithMIMEType_ConformingTo
- ( void )test_allUTIsWithMIMEType_conformingTo
{
XCTAssertGreaterThan( [ UTI allUTIsWithMIMEType: @"audio/mpeg" conformingTo: [ UTI audioTypeUTI ] ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithMIMEType: @"audio/mpeg" conformingTo: [ UTI textTypeUTI ] ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithNSPboardType
{

XCTAssertGreaterThan( [ UTI allUTIsWithNSPboardType: NSVCardPboardType ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithNSPboardType: @"Unknown pasteboard type" ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithNSPboardType_allowDynamic
{

XCTAssertGreaterThan( [ UTI allUTIsWithNSPboardType: @"Unknown pasteboard type" allowDynamic: YES ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithNSPboardType: @"Unknown pasteboard type" allowDynamic: NO ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithNSPboardType_ConformingTo
- ( void )test_allUTIsWithNSPboardType_conformingTo
{

XCTAssertGreaterThan( [ UTI allUTIsWithNSPboardType: NSVCardPboardType conformingTo: [ UTI contactTypeUTI ] ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithNSPboardType: NSVCardPboardType conformingTo: [ UTI audioTypeUTI ] ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithOSType
{

XCTAssertGreaterThan( [ UTI allUTIsWithOSType: @"mpg4" ].count, ( NSUInteger )1 );
XCTAssertEqual( [ UTI allUTIsWithOSType: @"ABCD" ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithOSType_allowDynamic
{

XCTAssertGreaterThan( [ UTI allUTIsWithOSType: @"mpg4" allowDynamic: YES ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithOSType: @"ABCD" allowDynamic: NO ].count, ( NSUInteger )0 );
}

- ( void )test_allUTIsWithOSType_ConformingTo
- ( void )test_allUTIsWithOSType_conformingTo
{

XCTAssertGreaterThan( [ UTI allUTIsWithOSType: @"mpg4" conformingTo: [ UTI audioTypeUTI ] ].count, ( NSUInteger )0 );
XCTAssertEqual( [ UTI allUTIsWithOSType: @"ABCD" conformingTo: [ UTI textTypeUTI ] ].count, ( NSUInteger )0 );
}

- ( void )test_stringForOSType
Expand Down Expand Up @@ -1329,7 +1335,7 @@ - ( void )test_initWithNSPboardType
{
UTI * uti;

uti = [ [ UTI alloc ] initWithNSPboardType: @"Apple VCard pasteboard type" ];
uti = [ [ UTI alloc ] initWithNSPboardType: NSVCardPboardType ];

XCTAssertNotNil( uti );
XCTAssertTrue( [ uti isEqualToUTI: [ UTI vCardTypeUTI ] ] );
Expand All @@ -1353,11 +1359,11 @@ - ( void )test_initWithNSPboardType_conformingTo
{
UTI * uti;

uti = [ [ UTI alloc ] initWithNSPboardType: @"Apple VCard pasteboard type" conformingTo: [ UTI textTypeUTI ] ];
uti = [ [ UTI alloc ] initWithNSPboardType: NSVCardPboardType conformingTo: [ UTI textTypeUTI ] ];

XCTAssertNotNil( uti );

uti = [ [ UTI alloc ] initWithNSPboardType: @"Apple VCard pasteboard type" conformingTo: [ UTI imageTypeUTI ] ];
uti = [ [ UTI alloc ] initWithNSPboardType: NSVCardPboardType conformingTo: [ UTI imageTypeUTI ] ];

XCTAssertNil( uti );
}
Expand Down Expand Up @@ -1407,7 +1413,7 @@ - ( void )test_preferredTagForTagClass

XCTAssertEqualObjects( [ uti preferredTagForTagClass: UTITagClassFilenameExtension ], @"html" );
XCTAssertEqualObjects( [ uti preferredTagForTagClass: UTITagClassMIMEType ], @"text/html" );
XCTAssertEqualObjects( [ uti preferredTagForTagClass: UTITagClassNSPboardType ], @"Apple HTML pasteboard type" );
XCTAssertEqualObjects( [ uti preferredTagForTagClass: UTITagClassNSPboardType ], NSHTMLPboardType );
XCTAssertEqualObjects( [ uti preferredTagForTagClass: UTITagClassOSType ], @"HTML" );
}

Expand Down

0 comments on commit 989ab31

Please sign in to comment.