Skip to content

Commit cc9f7f0

Browse files
committed
[parser] ensure array are ordered and trimmed
1 parent 5c05b76 commit cc9f7f0

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

lib/parser/pbxproj.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/parser/pbxproj.pegjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ CommentedArrayEntry
157157
= val:Value _ comment:InlineComment ","
158158
{
159159
var result = Object.create(null);
160-
result.value = val;
161-
result.comment = comment;
160+
result.value = val.trim();
161+
result.comment = comment.trim();
162162
return result;
163163
}
164164

test/parser/with_array.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,17 @@ exports['should parse empty arrays'] = function (test) {
2323
test.equal(project.empties.length, 0);
2424
test.done();
2525
}
26+
27+
exports['should be correct ordered'] = function (test) {
28+
var archs = project.ARCHS;
29+
test.equal(archs[0], 'armv6');
30+
test.equal(archs[1], 'armv7');
31+
test.done();
32+
}
33+
34+
exports['should parse values and comments correctly'] = function (test) {
35+
var appDelegate = project.files[1]
36+
test.equal(appDelegate.value, '1D3623260D0F684500981E51')
37+
test.equal(appDelegate.comment, 'AppDelegate.m in Sources')
38+
test.done()
39+
}

0 commit comments

Comments
 (0)