// // P4ServerTest.m // MBMenuExtra // // Created by Michael Bishop on 12/10/09. // Copyright 2009 Perforce Software. All rights reserved. // #import "P4ServerTest.h" #import "P4Server.h" #import "P4Server_p.h" @implementation P4ServerTest - (void) setUp { // Create data structures here. } - (void) tearDown { // Release data structures here. } - (NSArray *)testDataForName:(NSString*)name { NSBundle * bundle = [NSBundle bundleForClass:[self class]]; STAssertTrue(bundle != nil, @"Bundle is nil"); NSLog( @"Path for class (%@): %@", [self class], [bundle bundlePath] ); NSURL * url = [bundle URLForResource:name withExtension:@"plist"]; STAssertTrue(url != nil, @"could not find '%@' resource", name); NSArray * p4Info = [NSArray arrayWithContentsOfURL:url]; STAssertTrue(p4Info != nil, @"could not create an array from '%@' resource at %@", name, url); STAssertTrue([p4Info count], @"'%@' resource has no entries", name); return p4Info; } - (void)testPortChanging { P4Server * server = [[P4Server alloc] init]; server.p4port = @"perforce:1666"; STAssertEqualObjects(server.p4port, @"perforce:1666", @"setting server port failed"); { NSArray * info = [self testDataForName:@"p4_info"]; server.info = [info objectAtIndex:0]; STAssertTrue(server.info != nil, @"Info is nil"); } { NSArray * users = [self testDataForName:@"p4_users"]; server.users = users; STAssertTrue(server.users != nil, @"Users is nil"); } server.p4port = @"localhost:1666"; STAssertTrue(server.info == nil, @"Info should be nil after setting the port"); STAssertTrue(server.users == nil, @"Users should be nil after setting the port"); STAssertTrue(server.clients == nil, @"Clients should be nil after setting the port"); [server release]; } /* - (void)test2 { P4Server * server = [[P4Server alloc] init]; server.p4port = @"perforce:1666"; server.user = @"mbishop"; { NSArray * clients = [self testDataForName:@"p4_clients"]; server.clients = clients; STAssertTrue(server.clients != nil, @"Clients is nil"); } server.user = @"mbishop"; STAssertTrue(server.clients != nil, @"Clients should not be nil after setting the user to the same value"); server.user = @"mbishopw"; STAssertTrue(server.clients == nil, @"Clients should be nil after setting the user"); [server release]; } */ @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 20722 | jdputsch | initial branch, prep for -Zapp= support | ||
//guest/michael_bishop/MacMenu/src/P4Menu/Source/P4ServerTest.m | |||||
#1 | 8331 | Matt Attaway |
Adding initial version of MacMenu for Perforce MacMenu is a helpful Perforce client that sits in your toolbar. It allows you to run standard Perforce operations on the document that is open the currently active editor/viewer. |