Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[InfoPlist] Properly format serialized arrays
Adds a newline after the </array> tag
  • Loading branch information
segiddins committed Jan 5, 2016
1 parent 43082b2 commit 2a0a8d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cocoapods/generator/info_plist_file.rb
Expand Up @@ -88,7 +88,7 @@ def serialize(value, output, indentation = 0)
when Array
output << indent << "<array>\n"
value.each { |v| serialize(v, output, indentation + 2) }
output << indent << '</array>'
output << indent << "</array>\n"
when Hash
output << indent << "<dict>\n"
value.to_a.sort_by(&:first).each do |key, v|
Expand Down
17 changes: 17 additions & 0 deletions spec/unit/generator/info_plist_file_spec.rb
Expand Up @@ -85,6 +85,23 @@ module Pod
Xcodeproj::Plist.read_from_path(file)['UIRequiredDeviceCapabilities'].should == %w(arm64)
end

it 'properly formats serialized arrays' do
generator = Generator::InfoPlistFile.new(mock('Target'))
generator.send(:to_plist, 'array' => %w(a b)).should == <<-PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>array</key>
<array>
<string>a</string>
<string>b</string>
</array>
</dict>
</plist>
PLIST
end

it 'uses the specified bundle_package_type' do
target = mock('Target', :platform => stub(:name => :ios))
generator = Generator::InfoPlistFile.new(target, :bundle_package_type => :bndl)
Expand Down

0 comments on commit 2a0a8d6

Please sign in to comment.