Skip to content

Commit 3c34b1c

Browse files
author
jblues
committedNov 21, 2015
Fix accidental edit of string in refactoring.
1 parent 800366f commit 3c34b1c

File tree

7 files changed

+63
-11
lines changed

7 files changed

+63
-11
lines changed
 

‎.idea/XcodeEditor.iml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Source/Utils/XCKeyBuilder.m

+12-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
@implementation XCKeyBuilder
2020

21-
/* ================================================= Class Methods ================================================== */
21+
//-------------------------------------------------------------------------------------------
22+
#pragma mark - Class Methods
23+
//-------------------------------------------------------------------------------------------
24+
2225
+ (XCKeyBuilder*)forItemNamed:(NSString*)name
2326
{
2427
NSData* data = [name dataUsingEncoding:NSUTF8StringEncoding];
@@ -35,7 +38,10 @@ + (XCKeyBuilder*)createUnique
3538
return [[XCKeyBuilder alloc] initHashValueMD5HashWithBytes:&bytes length:sizeof(bytes)];
3639
}
3740

38-
/* ================================================== Initializers ================================================== */
41+
//-------------------------------------------------------------------------------------------
42+
#pragma mark - Initialization & Destruction
43+
//-------------------------------------------------------------------------------------------
44+
3945
- (id)initHashValueMD5HashWithBytes:(const void*)bytes length:(NSUInteger)length
4046
{
4147
self = [super init];
@@ -46,7 +52,10 @@ - (id)initHashValueMD5HashWithBytes:(const void*)bytes length:(NSUInteger)length
4652
return self;
4753
}
4854

49-
/* ================================================ Interface Methods =============================================== */
55+
//-------------------------------------------------------------------------------------------
56+
#pragma mark - Interface Methods
57+
//-------------------------------------------------------------------------------------------
58+
5059
- (NSString*)build
5160
{
5261
NSInteger byteLength = sizeof(HashValueMD5Hash);

‎Source/XCGroup.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ - (NSDictionary *)makeFileReferenceWithPath:(NSString *)path name:(NSString *)na
643643
if (path != nil) {
644644
reference[@"path"] = path;
645645
}
646-
reference[@"sourceTree"] = @"<_group>";
646+
reference[@"sourceTree"] = @"<group>";
647647
return reference;
648648
}
649649

@@ -652,7 +652,7 @@ - (NSDictionary *)asDictionary
652652
{
653653
NSMutableDictionary *groupData = [NSMutableDictionary dictionary];
654654
groupData[@"isa"] = [NSString xce_stringFromMemberType:PBXGroupType];
655-
groupData[@"sourceTree"] = @"<_group>";
655+
groupData[@"sourceTree"] = @"<group>";
656656

657657
if (_alias != nil) {
658658
groupData[@"name"] = _alias;

‎XcodeEditor.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
6B2C23301BFFFAFC009F4BA7 /* XcodeEditorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XcodeEditorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6666
6B2C23341BFFFAFC009F4BA7 /* XcodeEditorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XcodeEditorTests.m; sourceTree = "<group>"; };
6767
6B2C23361BFFFAFC009F4BA7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
68+
BA798001D353245614B3C335 /* ClassCalledJanine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassCalledJanine.h; sourceTree = "<group>"; };
6869
BA79800F190C0CA230C477CF /* XCSubProjectDefinition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCSubProjectDefinition.m; sourceTree = "<group>"; };
6970
BA798057DB461DE7AABC582A /* XCFileOperationQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCFileOperationQueue.m; sourceTree = "<group>"; };
7071
BA7980A38110FB4C766C093E /* XCProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCProject.h; sourceTree = "<group>"; };
@@ -91,6 +92,7 @@
9192
BA79854A64EF566049A284BD /* XCKeyBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCKeyBuilder.h; sourceTree = "<group>"; };
9293
BA7985D7F0551F6C47143FF4 /* XcodeGroupMember.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XcodeGroupMember.h; sourceTree = "<group>"; };
9394
BA79861E7B26FAE7C1CC88C2 /* XCXibDefinition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCXibDefinition.h; sourceTree = "<group>"; };
95+
BA79863006603FE6EB1FA6F1 /* ClassCalledJanine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClassCalledJanine.m; sourceTree = "<group>"; };
9496
BA79869C1E09F1947AF90301 /* XcodeSourceFileType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XcodeSourceFileType.h; sourceTree = "<group>"; };
9597
BA7986C4CA851EEFC8C6BE18 /* XCTarget.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCTarget.m; sourceTree = "<group>"; };
9698
BA79870FA7C8A49D306D8A38 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = "<group>"; };
@@ -309,6 +311,8 @@
309311
BA798C28A6E87447B6F15C85 /* project.pbxproj */,
310312
BA79836D36F9335915620E13 /* HelloWorldLayer.header */,
311313
BA79813BA8C71435D517BD58 /* ESA_Sales_Foobar_ViewController.impl */,
314+
BA79863006603FE6EB1FA6F1 /* ClassCalledJanine.m */,
315+
BA798001D353245614B3C335 /* ClassCalledJanine.h */,
312316
);
313317
path = Files;
314318
sourceTree = "<group>";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#import <Foundation/Foundation.h>
2+
3+
4+
@interface ClassCalledJanine : NSObject
5+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#import "ClassCalledJanine.h"
2+
3+
4+
@implementation ClassCalledJanine
5+
{
6+
7+
}
8+
@end

‎XcodeEditorTests/XCGroupTests.m

+30-6
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ - (void)setUp
6767

6868
- (void)test_allows_initialization_with
6969
{
70-
XCGroup *aGroup = [XCGroup groupWithProject:_project key:@"abcd1234" alias:@"Main" path:@"Source/Main" children:nil];
70+
XCGroup *aGroup =
71+
[XCGroup groupWithProject:_project key:@"abcd1234" alias:@"Main" path:@"Source/Main" children:nil];
7172

7273
XCTAssertNotNil(aGroup);
7374
XCTAssertEqualObjects([aGroup key], @"abcd1234");
@@ -456,11 +457,34 @@ - (void)test_allows_deleting_a_group
456457
for (XCGroup *group in project.groups) {
457458
NSLog(@"Group: %@", group.pathRelativeToProjectRoot);
458459
}
459-
// XCGroup *group = [project groupWithPathFromRoot:@"ProjectToEdit/GroupToDelete"];
460-
// XCTAssertNotNil(group);
461-
//
462-
// [group removeFromParentDeletingChildren:YES];
463-
// [project save];
460+
XCGroup *group = [project groupWithPathFromRoot:@"ProjectToEdit/GroupToDelete"];
461+
462+
XCClassDefinition *classDefinition = [XCClassDefinition classDefinitionWithName:@"ClassCalledJanine"];
463+
464+
[classDefinition setHeader:NSStringWithXCTestResource(@"ClassCalledJanine.h")];
465+
[classDefinition setSource:NSStringWithXCTestResource(@"ClassCalledJanine.m")];
466+
467+
NSLog(@"Class definition: %@", classDefinition);
468+
469+
[group addClass:classDefinition];
470+
[project save];
471+
472+
XCSourceFile *fileResource = [project fileWithName:@"ClassCalledJanine.m"];
473+
XCTAssertNotNil(fileResource);
474+
475+
XCTarget *target = [project targetWithName:@"ProjectToEdit"];
476+
XCTAssertNotNil(target);
477+
[target addMember:fileResource];
478+
479+
fileResource = [project fileWithName:@"ClassCalledJanine.m"];
480+
XCTAssertTrue([fileResource isBuildFile]);
481+
482+
[project save];
483+
NSLog(@"Done adding source file.");
484+
485+
486+
// [group removeFromParentDeletingChildren:YES];
487+
[project save];
464488
}
465489

466490

0 commit comments

Comments
 (0)
Please sign in to comment.