Skip to content

Commit

Permalink
Debug windows diff
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Aug 7, 2023
1 parent 4c4c49b commit 858f145
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/mini_mime_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def should_prioritize_extensions_correctly

if defined? MIME::Types
def test_full_parity_with_mime_types
skip("Windows MIME::Types isn't reliable") if RUBY_PLATFORM.match?(/windows/i)

exts = Set.new
MIME::Types.each do |type|
type.extensions.each { |ext| exts << ext }
end

differences = []

exts.each do |ext|
types = MIME::Types.type_for("a.#{ext}")

Expand All @@ -74,9 +74,15 @@ def test_full_parity_with_mime_types
# if type.content_type != MiniMime.lookup_by_filename("a.#{ext}").content_type
# puts "#{ext} Expected #{type.content_type} Got #{MiniMime.lookup_by_filename("a.#{ext}").content_type}"
# end
expected = type.content_type
actual = MiniMime.lookup_by_filename("a.#{ext}").content_type

assert_equal type.content_type, MiniMime.lookup_by_filename("a.#{ext}").content_type
if expected != actual
differences << %{Expected ".#{ext}" to return #{expected.inspect}, got: #{actual.inspect}}
end
end

assert differences.empty?, differences.join("\n")
end
end
end

0 comments on commit 858f145

Please sign in to comment.