mime-types 1.16 → 1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/.hoerc +12 -0
- data/{History.txt → History.rdoc} +17 -0
- data/Licence.rdoc +10 -0
- data/Manifest.txt +36 -6
- data/README.rdoc +19 -0
- data/Rakefile +138 -255
- data/lib/mime/types.rb +117 -25
- data/lib/mime/{types.rb.data → types/application} +306 -690
- data/lib/mime/types/application.mac +2 -0
- data/lib/mime/types/application.nonstandard +114 -0
- data/lib/mime/types/application.obsolete +40 -0
- data/lib/mime/types/audio +131 -0
- data/lib/mime/types/audio.nonstandard +10 -0
- data/lib/mime/types/audio.obsolete +1 -0
- data/lib/mime/types/image +43 -0
- data/lib/mime/types/image.nonstandard +17 -0
- data/lib/mime/types/image.obsolete +5 -0
- data/lib/mime/types/message +19 -0
- data/lib/mime/types/message.obsolete +1 -0
- data/lib/mime/types/model +15 -0
- data/lib/mime/types/multipart +14 -0
- data/lib/mime/types/multipart.nonstandard +1 -0
- data/lib/mime/types/multipart.obsolete +7 -0
- data/lib/mime/types/other.nonstandard +8 -0
- data/lib/mime/types/text +54 -0
- data/lib/mime/types/text.nonstandard +5 -0
- data/lib/mime/types/text.obsolete +7 -0
- data/lib/mime/types/text.vms +1 -0
- data/lib/mime/types/video +68 -0
- data/lib/mime/types/video.nonstandard +11 -0
- data/lib/mime/types/video.obsolete +3 -0
- data/mime-types.gemspec +40 -26
- data/test/test_mime_type.rb +262 -300
- data/test/test_mime_types.rb +74 -97
- data/type-lists/application.txt +951 -0
- data/type-lists/audio.txt +132 -0
- data/type-lists/image.txt +43 -0
- data/type-lists/message.txt +20 -0
- data/type-lists/model.txt +15 -0
- data/type-lists/multipart.txt +14 -0
- data/type-lists/text.txt +57 -0
- data/type-lists/video.txt +67 -0
- metadata +205 -64
- data.tar.gz.sig +0 -2
- data/Install.txt +0 -17
- data/Licence.txt +0 -15
- data/README.txt +0 -28
- data/setup.rb +0 -1585
- metadata.gz.sig +0 -0
data/lib/mime/types/text
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
text/1d-interleaved-parityfec 'IANA,RFC6015
|
2
|
+
text/RED 'IANA,RFC4102
|
3
|
+
text/calendar 'IANA,RFC5545
|
4
|
+
text/css @css :8bit 'IANA,RFC2318
|
5
|
+
text/csv @csv :8bit 'IANA,RFC4180
|
6
|
+
text/dns 'IANA,RFC4027
|
7
|
+
text/enriched 'IANA,RFC1896
|
8
|
+
text/example 'IANA,RFC4735
|
9
|
+
text/fwdred 'IANA,RFC6354
|
10
|
+
text/html @html,htm,htmlx,shtml,htx :8bit 'IANA,RFC2854
|
11
|
+
text/n3 'IANA,[Prud'hommeaux=Prudhommeaux],[W3C]
|
12
|
+
text/parityfec 'IANA,RFC5109
|
13
|
+
text/plain @txt,asc,c,cc,h,hh,cpp,hpp,dat,hlp 'IANA,RFC2046,RFC3676,RFC5147
|
14
|
+
text/prs.fallenstein.rst @rst 'IANA,[Fallenstein]
|
15
|
+
text/prs.lines.tag 'IANA,[Lines]
|
16
|
+
text/rfc822-headers 'IANA,RFC3462
|
17
|
+
text/richtext @rtx :8bit 'IANA,RFC2045,RFC2046
|
18
|
+
text/rtf @rtf :8bit 'IANA,[Lindner]
|
19
|
+
text/rtp-enc-aescm128 'IANA,[3GPP]
|
20
|
+
text/rtx 'IANA,RFC4588
|
21
|
+
text/sgml @sgml,sgm 'IANA,RFC1874
|
22
|
+
text/t140 'IANA,RFC4103
|
23
|
+
text/tab-separated-values @tsv 'IANA,[Lindner]
|
24
|
+
text/troff @t,tr,roff,troff :8bit 'IANA,RFC4263
|
25
|
+
text/turtle 'IANA,[Prud'hommeaux=Prudhommeaux],[W3C]
|
26
|
+
text/ulpfec 'IANA,RFC5109
|
27
|
+
text/uri-list 'IANA,RFC2483
|
28
|
+
text/vcard 'IANA,RFC6350
|
29
|
+
text/vnd.DMClientScript 'IANA,[Bradley]
|
30
|
+
text/vnd.IPTC.NITF 'IANA,[IPTC]
|
31
|
+
text/vnd.IPTC.NewsML 'IANA,[IPTC]
|
32
|
+
text/vnd.abc 'IANA,[Allen]
|
33
|
+
text/vnd.curl 'IANA,[Byrnes]
|
34
|
+
text/vnd.dvb.subtitle 'IANA,[Siebert],[Lagally]
|
35
|
+
text/vnd.esmertec.theme-descriptor 'IANA,[Eilemann]
|
36
|
+
text/vnd.fly 'IANA,[Gurney]
|
37
|
+
text/vnd.fmi.flexstor 'IANA,[Hurtta]
|
38
|
+
text/vnd.graphviz 'IANA,[Ellson]
|
39
|
+
text/vnd.in3d.3dml 'IANA,[Powers]
|
40
|
+
text/vnd.in3d.spot 'IANA,[Powers]
|
41
|
+
text/vnd.latex-z 'IANA,[Lubos]
|
42
|
+
text/vnd.motorola.reflex 'IANA,[Patton]
|
43
|
+
text/vnd.ms-mediapackage 'IANA,[Nelson]
|
44
|
+
text/vnd.net2phone.commcenter.command @ccc 'IANA,[Xie]
|
45
|
+
text/vnd.radisys.msml-basic-layout 'IANA,RFC5707
|
46
|
+
text/vnd.si.uricatalogue 'IANA,[Parks Young=ParksYoung]
|
47
|
+
text/vnd.sun.j2me.app-descriptor @jad :8bit 'IANA,[G.Adams]
|
48
|
+
text/vnd.trolltech.linguist 'IANA,[D.Lambert]
|
49
|
+
text/vnd.wap.si @si 'IANA,[WAP-Forum]
|
50
|
+
text/vnd.wap.sl @sl 'IANA,[WAP-Forum]
|
51
|
+
text/vnd.wap.wml @wml 'IANA,[Stark]
|
52
|
+
text/vnd.wap.wmlscript @wmls 'IANA,[Stark]
|
53
|
+
text/xml @xml,dtd :8bit 'IANA,RFC3023
|
54
|
+
text/xml-external-parsed-entity 'IANA,RFC3023
|
@@ -0,0 +1,7 @@
|
|
1
|
+
!text/directory 'IANA,RFC2425,RFC6350
|
2
|
+
!text/ecmascript 'IANA,RFC4329
|
3
|
+
!text/javascript 'IANA,RFC4329
|
4
|
+
!text/x-rtf @rtf :8bit =use-instead:text/rtf
|
5
|
+
!text/x-vnd.flatland.3dml =use-instead:model/vnd.flatland.3dml
|
6
|
+
*!text/comma-separated-values @csv :8bit =use-instead:text/csv
|
7
|
+
*!text/vnd.flatland.3dml =use-instead:model/vnd.flatland.3dml
|
@@ -0,0 +1 @@
|
|
1
|
+
vms:text/plain @doc :8bit
|
@@ -0,0 +1,68 @@
|
|
1
|
+
video/1d-interleaved-parityfec 'IANA,RFC6015
|
2
|
+
video/3gpp @3gp,3gpp 'IANA,RFC3839,RFC6381
|
3
|
+
video/3gpp-tt 'IANA,RFC4396
|
4
|
+
video/3gpp2 'IANA,RFC4393,RFC6381
|
5
|
+
video/BMPEG 'IANA,RFC3555
|
6
|
+
video/BT656 'IANA,RFC3555
|
7
|
+
video/CelB 'IANA,RFC3555
|
8
|
+
video/DV 'IANA,RFC3189
|
9
|
+
video/H261 'IANA,RFC4587
|
10
|
+
video/H263 'IANA,RFC3555
|
11
|
+
video/H263-1998 'IANA,RFC4629
|
12
|
+
video/H263-2000 'IANA,RFC4629
|
13
|
+
video/H264 'IANA,RFC6184
|
14
|
+
video/H264-RCDO 'IANA,RFC6185
|
15
|
+
video/H264-SVC 'IANA,RFC6190
|
16
|
+
video/JPEG 'IANA,RFC3555
|
17
|
+
video/MJ2 @mj2,mjp2 'IANA,RFC3745
|
18
|
+
video/MP1S 'IANA,RFC3555
|
19
|
+
video/MP2P 'IANA,RFC3555
|
20
|
+
video/MP2T 'IANA,RFC3555
|
21
|
+
video/MP4V-ES 'IANA,RFC6416
|
22
|
+
video/MPV 'IANA,RFC3555
|
23
|
+
video/SMPTE292M 'IANA,RFC3497
|
24
|
+
video/example 'IANA,RFC4735
|
25
|
+
video/jpeg2000 'IANA,RFC5371,RFC5372
|
26
|
+
video/mp4 @mp4,mpg4 'IANA,RFC4337,RFC6381
|
27
|
+
video/mpeg @mp2,mpe,mp3g,mpg :base64 'IANA,RFC2045,RFC2046
|
28
|
+
video/mpeg4-generic 'IANA,RFC3640
|
29
|
+
video/nv 'IANA,RFC4856
|
30
|
+
video/ogg @ogv 'IANA,RFC5334
|
31
|
+
video/parityfec 'IANA,RFC5109
|
32
|
+
video/pointer 'IANA,RFC2862
|
33
|
+
video/quicktime @qt,mov :base64 'IANA,[Lindner]
|
34
|
+
video/raw 'IANA,RFC4175
|
35
|
+
video/rtp-enc-aescm128 'IANA,[3GPP]
|
36
|
+
video/rtx 'IANA,RFC4588
|
37
|
+
video/ulpfec 'IANA,RFC5109
|
38
|
+
video/vc1 'IANA,RFC4425
|
39
|
+
video/vnd.CCTV 'IANA,[Rottmann]
|
40
|
+
video/vnd.dece.hd 'IANA,[Dolan]
|
41
|
+
video/vnd.dece.mobile 'IANA,[Dolan]
|
42
|
+
video/vnd.dece.mp4 'IANA,[Dolan]
|
43
|
+
video/vnd.dece.pd 'IANA,[Dolan]
|
44
|
+
video/vnd.dece.sd 'IANA,[Dolan]
|
45
|
+
video/vnd.dece.video 'IANA,[Dolan]
|
46
|
+
video/vnd.directv.mpeg 'IANA,[Zerbe]
|
47
|
+
video/vnd.dvb.file 'IANA,[Siebert],[Murray]
|
48
|
+
video/vnd.fvt 'IANA,[Fuldseth]
|
49
|
+
video/vnd.hns.video 'IANA,[Swaminathan]
|
50
|
+
video/vnd.iptvforum.1dparityfec-1010 'IANA,[Nakamura]
|
51
|
+
video/vnd.iptvforum.1dparityfec-2005 'IANA,[Nakamura]
|
52
|
+
video/vnd.iptvforum.2dparityfec-1010 'IANA,[Nakamura]
|
53
|
+
video/vnd.iptvforum.2dparityfec-2005 'IANA,[Nakamura]
|
54
|
+
video/vnd.iptvforum.ttsavc 'IANA,[Nakamura]
|
55
|
+
video/vnd.iptvforum.ttsmpeg2 'IANA,[Nakamura]
|
56
|
+
video/vnd.motorola.video 'IANA,[McGinty]
|
57
|
+
video/vnd.motorola.videop 'IANA,[McGinty]
|
58
|
+
video/vnd.mpegurl @mxu,m4u :8bit 'IANA,[Recktenwald]
|
59
|
+
video/vnd.ms-playready.media.pyv 'IANA,[DiAcetis]
|
60
|
+
video/vnd.nokia.interleaved-multimedia @nim 'IANA,[Kangaslampi]
|
61
|
+
video/vnd.nokia.videovoip 'IANA,[Nokia]
|
62
|
+
video/vnd.objectvideo @mp4 'IANA,[Clark]
|
63
|
+
video/vnd.sealed.mpeg1 @s11 'IANA,[Petersen]
|
64
|
+
video/vnd.sealed.mpeg4 @smpg,s14 'IANA,[Petersen]
|
65
|
+
video/vnd.sealed.swf @sswf,ssw 'IANA,[Petersen]
|
66
|
+
video/vnd.sealedmedia.softseal.mov @smov,smo,s1q 'IANA,[Petersen]
|
67
|
+
video/vnd.uvvu.mp4 'IANA,[Dolan]
|
68
|
+
video/vnd.vivo @viv,vivo 'IANA,[Wolfe]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
video/x-dl @dl :base64
|
2
|
+
video/x-fli @fli :base64
|
3
|
+
video/x-flv @flv :base64
|
4
|
+
video/x-gl @gl :base64
|
5
|
+
video/x-ms-asf @asf,asx
|
6
|
+
video/x-ms-wm @wm
|
7
|
+
video/x-ms-wmv @wmv
|
8
|
+
video/x-ms-wmx @wmx
|
9
|
+
video/x-ms-wvx @wvx
|
10
|
+
video/x-msvideo @avi :base64
|
11
|
+
video/x-sgi-movie @movie :base64
|
data/mime-types.gemspec
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "1.16"
|
4
|
+
s.name = "mime-types"
|
5
|
+
s.version = "1.16.20111022003230"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Austin Ziegler"]
|
9
|
-
s.
|
10
|
-
s.
|
11
|
-
s.description = %q{MIME::Types for Ruby originally based on and synchronized with MIME::Types for Perl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the data format for the MIME::Type list has changed and the synchronization will no longer happen.}
|
9
|
+
s.date = "2011-10-22"
|
10
|
+
s.description = "This library allows for the identification of a file's likely MIME content\ntype. This is release 1.17. The identification of MIME content type is based\non a file's filename extensions.\n\nMIME::Types for Ruby originally based on and synchronized with MIME::Types for\nPerl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the data\nformat for the MIME::Type list has changed and the synchronization will no\nlonger happen.\n\nHomepage:: http://mime-types.rubyforge.org/\nCopyright:: 2002 - 2011, Austin Ziegler\n Based in part on prior work copyright Mark Overmeer\n\n:include: License.rdoc"
|
12
11
|
s.email = ["austin@rubyforge.org"]
|
13
|
-
s.extra_rdoc_files = ["History.txt", "Install.txt", "Licence.txt", "README.txt"]
|
14
|
-
s.files = ["History.txt", "Install.txt", "Licence.txt", "Manifest.txt", "README.txt", "Rakefile", "lib/mime/types.rb", "lib/mime/types.rb.data", "setup.rb", "test/test_mime_type.rb", "test/test_mime_types.rb"]
|
15
|
-
s.
|
16
|
-
s.
|
17
|
-
s.rdoc_options = ["--main", "README.txt"]
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Install.txt", "Licence.txt", "Manifest.txt", "README.txt", "History.rdoc", "Licence.rdoc", "README.rdoc"]
|
13
|
+
s.files = ["History.txt", "Install.txt", "Licence.txt", "Manifest.txt", "README.txt", "Rakefile", "lib/mime/types.rb", "lib/mime/types.rb.data", "mime-types.gemspec", "setup.rb", "test/test_mime_type.rb", "test/test_mime_types.rb", "History.rdoc", "Licence.rdoc", "README.rdoc", ".gemtest"]
|
14
|
+
s.homepage = "http://mime-types.rubyforge.org/"
|
15
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
18
16
|
s.require_paths = ["lib"]
|
19
|
-
s.rubyforge_project =
|
20
|
-
s.rubygems_version =
|
21
|
-
s.
|
22
|
-
s.summary = %q{Manages a MIME Content-Type database that will return the Content-Type for a given filename.}
|
17
|
+
s.rubyforge_project = "mime-types"
|
18
|
+
s.rubygems_version = "1.8.10"
|
19
|
+
s.summary = "This library allows for the identification of a file's likely MIME content type"
|
23
20
|
s.test_files = ["test/test_mime_type.rb", "test/test_mime_types.rb"]
|
24
21
|
|
25
22
|
if s.respond_to? :specification_version then
|
26
|
-
|
27
|
-
s.specification_version = 2
|
23
|
+
s.specification_version = 3
|
28
24
|
|
29
|
-
if Gem::Version.new(Gem::
|
30
|
-
s.add_development_dependency(%q<
|
31
|
-
s.add_development_dependency(%q<
|
32
|
-
s.add_development_dependency(%q<
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
|
27
|
+
s.add_development_dependency(%q<minitest>, [">= 2.6.2"])
|
28
|
+
s.add_development_dependency(%q<nokogiri>, ["~> 1.2"])
|
29
|
+
s.add_development_dependency(%q<minitest>, ["~> 2.0"])
|
30
|
+
s.add_development_dependency(%q<hoe-doofus>, ["~> 1.0"])
|
31
|
+
s.add_development_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
32
|
+
s.add_development_dependency(%q<hoe-git>, ["~> 1.0"])
|
33
|
+
s.add_development_dependency(%q<hoe-seattlerb>, ["~> 1.0"])
|
34
|
+
s.add_development_dependency(%q<hoe>, ["~> 2.12"])
|
33
35
|
else
|
34
|
-
s.add_dependency(%q<
|
35
|
-
s.add_dependency(%q<
|
36
|
-
s.add_dependency(%q<
|
36
|
+
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
37
|
+
s.add_dependency(%q<minitest>, [">= 2.6.2"])
|
38
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.2"])
|
39
|
+
s.add_dependency(%q<minitest>, ["~> 2.0"])
|
40
|
+
s.add_dependency(%q<hoe-doofus>, ["~> 1.0"])
|
41
|
+
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
42
|
+
s.add_dependency(%q<hoe-git>, ["~> 1.0"])
|
43
|
+
s.add_dependency(%q<hoe-seattlerb>, ["~> 1.0"])
|
44
|
+
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
37
45
|
end
|
38
46
|
else
|
39
|
-
s.add_dependency(%q<
|
40
|
-
s.add_dependency(%q<
|
41
|
-
s.add_dependency(%q<
|
47
|
+
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
48
|
+
s.add_dependency(%q<minitest>, [">= 2.6.2"])
|
49
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.2"])
|
50
|
+
s.add_dependency(%q<minitest>, ["~> 2.0"])
|
51
|
+
s.add_dependency(%q<hoe-doofus>, ["~> 1.0"])
|
52
|
+
s.add_dependency(%q<hoe-gemspec>, ["~> 1.0"])
|
53
|
+
s.add_dependency(%q<hoe-git>, ["~> 1.0"])
|
54
|
+
s.add_dependency(%q<hoe-seattlerb>, ["~> 1.0"])
|
55
|
+
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
42
56
|
end
|
43
57
|
end
|
data/test/test_mime_type.rb
CHANGED
@@ -1,313 +1,276 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
#--
|
3
|
-
# MIME::Types
|
4
|
-
# A Ruby implementation of a MIME Types information library. Based in spirit
|
5
|
-
# on the Perl MIME::Types information library by Mark Overmeer.
|
6
|
-
# http://rubyforge.org/projects/mime-types/
|
7
|
-
#
|
8
|
-
# Licensed under the Ruby disjunctive licence with the GNU GPL or the Perl
|
9
|
-
# Artistic licence. See Licence.txt for more information.
|
10
|
-
#
|
11
|
-
# Copyright 2003 - 2009 Austin Ziegler
|
12
|
-
#++
|
13
1
|
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
|
14
2
|
|
15
3
|
require 'mime/types'
|
16
|
-
require '
|
4
|
+
require 'minitest/autorun'
|
5
|
+
#require 'test/unit' unless defined? $ZENTEST and $ZENTEST
|
17
6
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
7
|
+
class TestMIME_Type < MiniTest::Unit::TestCase
|
8
|
+
def yaml_mime_type_from_array
|
9
|
+
yaml = MIME::Type.from_array('text/x-yaml', %w(yaml yml), '8bit', 'linux')
|
10
|
+
end
|
23
11
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
assert_instance_of(MIME::Type, @yaml)
|
29
|
-
assert_equal('text/yaml', @yaml.simplified)
|
30
|
-
end
|
12
|
+
def setup
|
13
|
+
@zip = MIME::Type.new('x-appl/x-zip') { |t| t.extensions = ['zip', 'zp'] }
|
14
|
+
end
|
31
15
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
'Extensions' => %w(yaml yml))
|
38
|
-
end
|
39
|
-
assert_instance_of(MIME::Type, @yaml)
|
40
|
-
assert_equal('text/yaml', @yaml.simplified)
|
41
|
-
end
|
16
|
+
def test_class_from_array
|
17
|
+
yaml = yaml_mime_type_from_array
|
18
|
+
assert_instance_of(MIME::Type, yaml)
|
19
|
+
assert_equal('text/yaml', yaml.simplified)
|
20
|
+
end
|
42
21
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
22
|
+
def test_class_from_hash
|
23
|
+
yaml = MIME::Type.from_hash('Content-Type' => 'text/x-yaml',
|
24
|
+
'Content-Transfer-Encoding' => '8bit',
|
25
|
+
'System' => 'linux',
|
26
|
+
'Extensions' => %w(yaml yml))
|
27
|
+
assert_instance_of(MIME::Type, yaml)
|
28
|
+
assert_equal('text/yaml', yaml.simplified)
|
29
|
+
end
|
51
30
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
assert_equal(@zip.simplified, 'appl/zip')
|
59
|
-
assert_equal(MIME::Type.simplified('x-xyz/abc'), 'xyz/abc')
|
60
|
-
end
|
31
|
+
def test_class_from_mime_type
|
32
|
+
zip2 = MIME::Type.from_mime_type(@zip)
|
33
|
+
assert_instance_of(MIME::Type, @zip)
|
34
|
+
assert_equal('appl/zip', @zip.simplified)
|
35
|
+
refute_equal(@zip.object_id, zip2.object_id)
|
36
|
+
end
|
61
37
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
assert('text/html' == MIME::Type.new('text/html'))
|
72
|
-
assert('text/html' < MIME::Type.new('text/plain'))
|
73
|
-
assert('text/plain' > MIME::Type.new('text/html'))
|
74
|
-
end
|
38
|
+
def test_class_simplified
|
39
|
+
assert_equal(MIME::Type.simplified('text/plain'), 'text/plain')
|
40
|
+
assert_equal(MIME::Type.simplified('image/jpeg'), 'image/jpeg')
|
41
|
+
assert_equal(MIME::Type.simplified('application/x-msword'), 'application/msword')
|
42
|
+
assert_equal(MIME::Type.simplified('text/vCard'), 'text/vcard')
|
43
|
+
assert_equal(MIME::Type.simplified('application/pkcs7-mime'), 'application/pkcs7-mime')
|
44
|
+
assert_equal(@zip.simplified, 'appl/zip')
|
45
|
+
assert_equal(MIME::Type.simplified('x-xyz/abc'), 'xyz/abc')
|
46
|
+
end
|
75
47
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
48
|
+
def test_CMP # '<=>'
|
49
|
+
assert(MIME::Type.new('text/plain') == MIME::Type.new('text/plain'))
|
50
|
+
assert(MIME::Type.new('text/plain') != MIME::Type.new('image/jpeg'))
|
51
|
+
assert(MIME::Type.new('text/plain') == 'text/plain')
|
52
|
+
assert(MIME::Type.new('text/plain') != 'image/jpeg')
|
53
|
+
assert(MIME::Type.new('text/plain') > MIME::Type.new('text/html'))
|
54
|
+
assert(MIME::Type.new('text/plain') > 'text/html')
|
55
|
+
assert(MIME::Type.new('text/html') < MIME::Type.new('text/plain'))
|
56
|
+
assert(MIME::Type.new('text/html') < 'text/plain')
|
57
|
+
assert('text/html' == MIME::Type.new('text/html'))
|
58
|
+
assert('text/html' < MIME::Type.new('text/plain'))
|
59
|
+
assert('text/plain' > MIME::Type.new('text/html'))
|
60
|
+
end
|
84
61
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
62
|
+
def test_ascii_eh
|
63
|
+
assert(MIME::Type.new('text/plain').ascii?)
|
64
|
+
refute(MIME::Type.new('image/jpeg').ascii?)
|
65
|
+
refute(MIME::Type.new('application/x-msword').ascii?)
|
66
|
+
assert(MIME::Type.new('text/vCard').ascii?)
|
67
|
+
refute(MIME::Type.new('application/pkcs7-mime').ascii?)
|
68
|
+
refute(@zip.ascii?)
|
69
|
+
end
|
93
70
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
end
|
71
|
+
def test_binary_eh
|
72
|
+
refute(MIME::Type.new('text/plain').binary?)
|
73
|
+
assert(MIME::Type.new('image/jpeg').binary?)
|
74
|
+
assert(MIME::Type.new('application/x-msword').binary?)
|
75
|
+
refute(MIME::Type.new('text/vCard').binary?)
|
76
|
+
assert(MIME::Type.new('application/pkcs7-mime').binary?)
|
77
|
+
assert(@zip.binary?)
|
78
|
+
end
|
103
79
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
assert_equal(@zip.content_type, 'x-appl/x-zip');
|
111
|
-
end
|
80
|
+
def test_complete_eh
|
81
|
+
yaml = yaml_mime_type_from_array
|
82
|
+
assert(yaml.complete?)
|
83
|
+
yaml.extensions = nil
|
84
|
+
refute(yaml.complete?)
|
85
|
+
end
|
112
86
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
'linux')
|
122
|
-
end
|
123
|
-
assert_equal(@yaml.encoding, '8bit')
|
124
|
-
assert_nothing_raised { @yaml.encoding = 'base64' }
|
125
|
-
assert_equal(@yaml.encoding, 'base64')
|
126
|
-
assert_nothing_raised { @yaml.encoding = :default }
|
127
|
-
assert_equal(@yaml.encoding, 'quoted-printable')
|
128
|
-
assert_raises(ArgumentError) { @yaml.encoding = 'binary' }
|
129
|
-
assert_equal(@zip.encoding, 'base64')
|
130
|
-
end
|
87
|
+
def test_content_type
|
88
|
+
assert_equal(MIME::Type.new('text/plain').content_type, 'text/plain')
|
89
|
+
assert_equal(MIME::Type.new('image/jpeg').content_type, 'image/jpeg')
|
90
|
+
assert_equal(MIME::Type.new('application/x-msword').content_type, 'application/x-msword')
|
91
|
+
assert_equal(MIME::Type.new('text/vCard').content_type, 'text/vCard')
|
92
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').content_type, 'application/pkcs7-mime')
|
93
|
+
assert_equal(@zip.content_type, 'x-appl/x-zip');
|
94
|
+
end
|
131
95
|
|
132
|
-
|
133
|
-
|
134
|
-
|
96
|
+
def test_encoding
|
97
|
+
assert_equal(MIME::Type.new('text/plain').encoding, 'quoted-printable')
|
98
|
+
assert_equal(MIME::Type.new('image/jpeg').encoding, 'base64')
|
99
|
+
assert_equal(MIME::Type.new('application/x-msword').encoding, 'base64')
|
100
|
+
assert_equal(MIME::Type.new('text/vCard').encoding, 'quoted-printable')
|
101
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').encoding, 'base64')
|
102
|
+
|
103
|
+
yaml = yaml_mime_type_from_array
|
104
|
+
assert_equal(yaml.encoding, '8bit')
|
105
|
+
yaml.encoding = 'base64'
|
106
|
+
assert_equal(yaml.encoding, 'base64')
|
107
|
+
yaml.encoding = :default
|
108
|
+
assert_equal(yaml.encoding, 'quoted-printable')
|
109
|
+
assert_raises(ArgumentError) { yaml.encoding = 'binary' }
|
110
|
+
assert_equal(@zip.encoding, 'base64')
|
111
|
+
end
|
135
112
|
|
136
|
-
|
137
|
-
|
138
|
-
|
113
|
+
def _test_default_encoding
|
114
|
+
raise NotImplementedError, 'Need to write test_default_encoding'
|
115
|
+
end
|
139
116
|
|
140
|
-
|
141
|
-
|
142
|
-
|
117
|
+
def _test_docs
|
118
|
+
raise NotImplementedError, 'Need to write test_docs'
|
119
|
+
end
|
143
120
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
assert(!MIME::Type.new('text/plain').eql?('text/plain'))
|
148
|
-
assert(!MIME::Type.new('text/plain').eql?('image/jpeg'))
|
149
|
-
end
|
121
|
+
def _test_docs_equals
|
122
|
+
raise NotImplementedError, 'Need to write test_docs_equals'
|
123
|
+
end
|
150
124
|
|
151
|
-
|
152
|
-
|
153
|
-
|
125
|
+
def test_eql?
|
126
|
+
assert(MIME::Type.new('text/plain').eql?(MIME::Type.new('text/plain')))
|
127
|
+
refute(MIME::Type.new('text/plain').eql?(MIME::Type.new('image/jpeg')))
|
128
|
+
refute(MIME::Type.new('text/plain').eql?('text/plain'))
|
129
|
+
refute(MIME::Type.new('text/plain').eql?('image/jpeg'))
|
130
|
+
end
|
154
131
|
|
155
|
-
|
156
|
-
|
157
|
-
|
132
|
+
def _test_encoding
|
133
|
+
raise NotImplementedError, 'Need to write test_encoding'
|
134
|
+
end
|
158
135
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
'linux')
|
163
|
-
end
|
164
|
-
assert_equal(@yaml.extensions, %w(yaml yml))
|
165
|
-
assert_nothing_raised { @yaml.extensions = 'yaml' }
|
166
|
-
assert_equal(@yaml.extensions, ['yaml'])
|
167
|
-
assert_equal(@zip.extensions.size, 2)
|
168
|
-
assert_equal(@zip.extensions, ['zip', 'zp'])
|
169
|
-
end
|
136
|
+
def _test_encoding_equals
|
137
|
+
raise NotImplementedError, 'Need to write test_encoding_equals'
|
138
|
+
end
|
170
139
|
|
171
|
-
|
172
|
-
|
173
|
-
|
140
|
+
def test_extensions
|
141
|
+
yaml = yaml_mime_type_from_array
|
142
|
+
assert_equal(yaml.extensions, %w(yaml yml))
|
143
|
+
yaml.extensions = 'yaml'
|
144
|
+
assert_equal(yaml.extensions, ['yaml'])
|
145
|
+
assert_equal(@zip.extensions.size, 2)
|
146
|
+
assert_equal(@zip.extensions, ['zip', 'zp'])
|
147
|
+
end
|
174
148
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
assert(!MIME::Type.new('text/plain').like?(MIME::Type.new('image/jpeg')))
|
179
|
-
assert(MIME::Type.new('text/plain').like?('text/plain'))
|
180
|
-
assert(MIME::Type.new('text/plain').like?('text/x-plain'))
|
181
|
-
assert(!MIME::Type.new('text/plain').like?('image/jpeg'))
|
182
|
-
end
|
149
|
+
def _test_extensions_equals
|
150
|
+
raise NotImplementedError, 'Need to write test_extensions_equals'
|
151
|
+
end
|
183
152
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
end
|
153
|
+
def test_like_eh
|
154
|
+
assert(MIME::Type.new('text/plain').like?(MIME::Type.new('text/plain')))
|
155
|
+
assert(MIME::Type.new('text/plain').like?(MIME::Type.new('text/x-plain')))
|
156
|
+
refute(MIME::Type.new('text/plain').like?(MIME::Type.new('image/jpeg')))
|
157
|
+
assert(MIME::Type.new('text/plain').like?('text/plain'))
|
158
|
+
assert(MIME::Type.new('text/plain').like?('text/x-plain'))
|
159
|
+
refute(MIME::Type.new('text/plain').like?('image/jpeg'))
|
160
|
+
end
|
193
161
|
|
194
|
-
|
195
|
-
|
196
|
-
|
162
|
+
def test_media_type
|
163
|
+
assert_equal(MIME::Type.new('text/plain').media_type, 'text')
|
164
|
+
assert_equal(MIME::Type.new('image/jpeg').media_type, 'image')
|
165
|
+
assert_equal(MIME::Type.new('application/x-msword').media_type, 'application')
|
166
|
+
assert_equal(MIME::Type.new('text/vCard').media_type, 'text')
|
167
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').media_type, 'application')
|
168
|
+
assert_equal(MIME::Type.new('x-chemical/x-pdb').media_type, 'chemical')
|
169
|
+
assert_equal(@zip.media_type, 'appl')
|
170
|
+
end
|
197
171
|
|
198
|
-
|
199
|
-
|
200
|
-
|
172
|
+
def _test_obsolete_eh
|
173
|
+
raise NotImplementedError, 'Need to write test_obsolete_eh'
|
174
|
+
end
|
201
175
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
'oddbox')
|
206
|
-
end
|
207
|
-
assert(!@yaml.platform?)
|
208
|
-
assert_nothing_raised { @yaml.system = nil }
|
209
|
-
assert(!@yaml.platform?)
|
210
|
-
assert_nothing_raised { @yaml.system = /#{RUBY_PLATFORM}/ }
|
211
|
-
assert(@yaml.platform?)
|
212
|
-
end
|
176
|
+
def _test_obsolete_equals
|
177
|
+
raise NotImplementedError, 'Need to write test_obsolete_equals'
|
178
|
+
end
|
213
179
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
180
|
+
def test_platform_eh
|
181
|
+
yaml = yaml_mime_type_from_array
|
182
|
+
refute(yaml.platform?)
|
183
|
+
yaml.system = nil
|
184
|
+
refute(yaml.platform?)
|
185
|
+
yaml.system = %r{#{RUBY_PLATFORM}}
|
186
|
+
assert(yaml.platform?)
|
187
|
+
end
|
220
188
|
|
221
|
-
|
222
|
-
|
223
|
-
|
189
|
+
def test_raw_media_type
|
190
|
+
assert_equal(MIME::Type.new('text/plain').raw_media_type, 'text')
|
191
|
+
assert_equal(MIME::Type.new('image/jpeg').raw_media_type, 'image')
|
192
|
+
assert_equal(MIME::Type.new('application/x-msword').raw_media_type, 'application')
|
193
|
+
assert_equal(MIME::Type.new('text/vCard').raw_media_type, 'text')
|
194
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').raw_media_type, 'application')
|
224
195
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
assert_equal(MIME::Type.new('application/x-msword').raw_sub_type, 'x-msword')
|
229
|
-
assert_equal(MIME::Type.new('text/vCard').raw_sub_type, 'vCard')
|
230
|
-
assert_equal(MIME::Type.new('application/pkcs7-mime').raw_sub_type, 'pkcs7-mime')
|
231
|
-
assert_equal(@zip.raw_sub_type, 'x-zip')
|
232
|
-
end
|
196
|
+
assert_equal(MIME::Type.new('x-chemical/x-pdb').raw_media_type, 'x-chemical')
|
197
|
+
assert_equal(@zip.raw_media_type, 'x-appl')
|
198
|
+
end
|
233
199
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
200
|
+
def test_raw_sub_type
|
201
|
+
assert_equal(MIME::Type.new('text/plain').raw_sub_type, 'plain')
|
202
|
+
assert_equal(MIME::Type.new('image/jpeg').raw_sub_type, 'jpeg')
|
203
|
+
assert_equal(MIME::Type.new('application/x-msword').raw_sub_type, 'x-msword')
|
204
|
+
assert_equal(MIME::Type.new('text/vCard').raw_sub_type, 'vCard')
|
205
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').raw_sub_type, 'pkcs7-mime')
|
206
|
+
assert_equal(@zip.raw_sub_type, 'x-zip')
|
207
|
+
end
|
242
208
|
|
243
|
-
|
244
|
-
|
245
|
-
|
209
|
+
def test_registered_eh
|
210
|
+
assert(MIME::Type.new('text/plain').registered?)
|
211
|
+
assert(MIME::Type.new('image/jpeg').registered?)
|
212
|
+
refute(MIME::Type.new('application/x-msword').registered?)
|
213
|
+
assert(MIME::Type.new('text/vCard').registered?)
|
214
|
+
assert(MIME::Type.new('application/pkcs7-mime').registered?)
|
215
|
+
refute(@zip.registered?)
|
216
|
+
end
|
246
217
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
assert(!MIME::Type.new('application/x-msword').signature?)
|
251
|
-
assert(MIME::Type.new('text/vCard').signature?)
|
252
|
-
assert(MIME::Type.new('application/pkcs7-mime').signature?)
|
253
|
-
end
|
218
|
+
def _test_registered_equals
|
219
|
+
raise NotImplementedError, 'Need to write test_registered_equals'
|
220
|
+
end
|
254
221
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
end
|
222
|
+
def test_signature_eh
|
223
|
+
refute(MIME::Type.new('text/plain').signature?)
|
224
|
+
refute(MIME::Type.new('image/jpeg').signature?)
|
225
|
+
refute(MIME::Type.new('application/x-msword').signature?)
|
226
|
+
assert(MIME::Type.new('text/vCard').signature?)
|
227
|
+
assert(MIME::Type.new('application/pkcs7-mime').signature?)
|
228
|
+
end
|
263
229
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
230
|
+
def test_simplified
|
231
|
+
assert_equal(MIME::Type.new('text/plain').simplified, 'text/plain')
|
232
|
+
assert_equal(MIME::Type.new('image/jpeg').simplified, 'image/jpeg')
|
233
|
+
assert_equal(MIME::Type.new('application/x-msword').simplified, 'application/msword')
|
234
|
+
assert_equal(MIME::Type.new('text/vCard').simplified, 'text/vcard')
|
235
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').simplified, 'application/pkcs7-mime')
|
236
|
+
assert_equal(MIME::Type.new('x-chemical/x-pdb').simplified, 'chemical/pdb')
|
237
|
+
end
|
272
238
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
assert_nothing_raised { @yaml.system = nil }
|
282
|
-
assert_nil(@yaml.system)
|
283
|
-
end
|
239
|
+
def test_sub_type
|
240
|
+
assert_equal(MIME::Type.new('text/plain').sub_type, 'plain')
|
241
|
+
assert_equal(MIME::Type.new('image/jpeg').sub_type, 'jpeg')
|
242
|
+
assert_equal(MIME::Type.new('application/x-msword').sub_type, 'msword')
|
243
|
+
assert_equal(MIME::Type.new('text/vCard').sub_type, 'vcard')
|
244
|
+
assert_equal(MIME::Type.new('application/pkcs7-mime').sub_type, 'pkcs7-mime')
|
245
|
+
assert_equal(@zip.sub_type, 'zip')
|
246
|
+
end
|
284
247
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
end
|
248
|
+
def test_system_equals
|
249
|
+
yaml = yaml_mime_type_from_array
|
250
|
+
assert_equal(yaml.system, %r{linux})
|
251
|
+
yaml.system = /win32/
|
252
|
+
assert_equal(yaml.system, %r{win32})
|
253
|
+
yaml.system = nil
|
254
|
+
assert_nil(yaml.system)
|
255
|
+
end
|
294
256
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
/linux/, nil, nil, nil, false])
|
302
|
-
end
|
257
|
+
def test_system_eh
|
258
|
+
yaml = yaml_mime_type_from_array
|
259
|
+
assert(yaml.system?)
|
260
|
+
yaml.system = nil
|
261
|
+
refute(yaml.system?)
|
262
|
+
end
|
303
263
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
264
|
+
def test_to_a
|
265
|
+
yaml = yaml_mime_type_from_array
|
266
|
+
assert_equal(yaml.to_a, ['text/x-yaml', %w(yaml yml), '8bit',
|
267
|
+
/linux/, nil, nil, nil, false])
|
268
|
+
end
|
269
|
+
|
270
|
+
def test_to_hash
|
271
|
+
yaml = yaml_mime_type_from_array
|
272
|
+
assert_equal(yaml.to_hash,
|
273
|
+
{ 'Content-Type' => 'text/x-yaml',
|
311
274
|
'Content-Transfer-Encoding' => '8bit',
|
312
275
|
'Extensions' => %w(yaml yml),
|
313
276
|
'System' => /linux/,
|
@@ -315,42 +278,41 @@ module TestMIME
|
|
315
278
|
'URL' => nil,
|
316
279
|
'Obsolete' => nil,
|
317
280
|
'Docs' => nil })
|
318
|
-
|
281
|
+
end
|
319
282
|
|
320
|
-
|
321
|
-
|
322
|
-
|
283
|
+
def test_to_s
|
284
|
+
assert_equal("#{MIME::Type.new('text/plain')}", 'text/plain')
|
285
|
+
end
|
323
286
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
end
|
331
|
-
assert_instance_of(MIME::Type, yaml)
|
332
|
-
assert_raises(MIME::InvalidContentType) { MIME::Type.new('apps') }
|
333
|
-
assert_raises(MIME::InvalidContentType) { MIME::Type.new(nil) }
|
287
|
+
def test_class_constructors
|
288
|
+
refute_nil(@zip)
|
289
|
+
yaml = MIME::Type.new('text/x-yaml') do |y|
|
290
|
+
y.extensions = %w(yaml yml)
|
291
|
+
y.encoding = '8bit'
|
292
|
+
y.system = 'linux'
|
334
293
|
end
|
294
|
+
assert_instance_of(MIME::Type, yaml)
|
295
|
+
assert_raises(MIME::InvalidContentType) { MIME::Type.new('apps') }
|
296
|
+
assert_raises(MIME::InvalidContentType) { MIME::Type.new(nil) }
|
297
|
+
end
|
335
298
|
|
336
|
-
|
337
|
-
|
338
|
-
|
299
|
+
def _test_to_str
|
300
|
+
raise NotImplementedError, 'Need to write test_to_str'
|
301
|
+
end
|
339
302
|
|
340
|
-
|
341
|
-
|
342
|
-
|
303
|
+
def _test_url
|
304
|
+
raise NotImplementedError, 'Need to write test_url'
|
305
|
+
end
|
343
306
|
|
344
|
-
|
345
|
-
|
346
|
-
|
307
|
+
def _test_url_equals
|
308
|
+
raise NotImplementedError, 'Need to write test_url_equals'
|
309
|
+
end
|
347
310
|
|
348
|
-
|
349
|
-
|
350
|
-
|
311
|
+
def _test_urls
|
312
|
+
raise NotImplementedError, 'Need to write test_urls'
|
313
|
+
end
|
351
314
|
|
352
|
-
|
353
|
-
|
354
|
-
end
|
315
|
+
def __test_use_instead
|
316
|
+
raise NotImplementedError, 'Need to write test_use_instead'
|
355
317
|
end
|
356
318
|
end
|