Skip to content

Commit e4d45d7

Browse files
committed
Added a unit test to verify correct source file removal from PBXFileReference after being modified by Xcode.
1 parent 09d6466 commit e4d45d7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/removeSourceFile.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,21 @@ exports.removeSourceFile = {
126126

127127
test.ok(!sourceObj);
128128
test.done();
129+
},
130+
'should remove file from PBXFileReference after modified by Xcode': function(test) {
131+
var fileRef = proj.addSourceFile('Plugins/file.m').fileRef;
132+
133+
// Simulate Xcode's behaviour of stripping quotes around path and name
134+
// properties.
135+
var entry = proj.pbxFileReferenceSection()[fileRef];
136+
entry.name = entry.name.replace(/^"(.*)"$/, "$1");
137+
entry.path = entry.path.replace(/^"(.*)"$/, "$1");
138+
139+
var newFile = proj.removeSourceFile('Plugins/file.m');
140+
141+
test.ok(newFile.uuid);
142+
test.ok(!proj.pbxFileReferenceSection()[fileRef]);
143+
test.done();
129144
}
130145
}
131146

0 commit comments

Comments
 (0)