Commit ec058332 authored by Marius Rackwitz's avatar Marius Rackwitz

[Validator] Check file suffix of module_map

parent cc80b803
......@@ -419,8 +419,14 @@ module Pod
end
def _validate_module_map
if spec.module_map && !file_accessor.module_map.exist?
error('module_map', 'Unable to find the specified module map file.')
if spec.module_map
unless file_accessor.module_map.exist?
error('module_map', 'Unable to find the specified module map file.')
end
unless file_accessor.module_map.extname == '.modulemap'
relative_path = file_accessor.module_map.relative_path_from file_accessor.root
error('module_map', "Unexpected file extension for modulemap file (#{relative_path}).")
end
end
end
......
......@@ -455,6 +455,16 @@ module Pod
validator.results.map(&:to_s).first.should.match /Unable to find the specified module map file./
validator.result_type.should == :error
end
it 'checks module_map accepts only modulemaps' do
file = write_podspec(stub_podspec(/.*source_files.*/, '"source_files": "JSONKit.*", "module_map": "JSONKit.m",'))
validator = Validator.new(file, SourcesManager.master.map(&:url))
validator.stubs(:build_pod)
validator.stubs(:validate_url)
validator.validate
validator.results.map(&:to_s).first.should.match /Unexpected file extension for modulemap file \(JSONKit\.m\)/
validator.result_type.should == :error
end
end
it 'validates a podspec with dependencies' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment