mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/rss/: use PNG instead of zlib as binary data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a73ba1def7
commit
bac3ea1fca
4 changed files with 16 additions and 21 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Mon Jul 28 21:32:17 2008 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* test/rss/: use PNG instead of zlib as binary data.
|
||||||
|
|
||||||
Mon Jul 28 21:24:33 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
Mon Jul 28 21:24:33 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* thread_win32.[ch] (cond_every_entry, rb_thread_cond_struct): reverted
|
* thread_win32.[ch] (cond_every_entry, rb_thread_cond_struct): reverted
|
||||||
|
|
BIN
test/rss/dot.png
Normal file
BIN
test/rss/dot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 B |
|
@ -557,20 +557,16 @@ EOA
|
||||||
|
|
||||||
def assert_atom_content_inline_other_text(generator)
|
def assert_atom_content_inline_other_text(generator)
|
||||||
_wrap_assertion do
|
_wrap_assertion do
|
||||||
require "zlib"
|
type = "image/png"
|
||||||
|
|
||||||
type = "application/zip"
|
|
||||||
assert_parse(generator.call(<<-EOA), :nothing_raised)
|
assert_parse(generator.call(<<-EOA), :nothing_raised)
|
||||||
<content type="#{type}"/>
|
<content type="#{type}"/>
|
||||||
EOA
|
EOA
|
||||||
|
|
||||||
text = ""
|
png_file = File.join(File.dirname(__FILE__), "dot.png")
|
||||||
char = "a"
|
png = File.open(png_file, "rb") do |file|
|
||||||
100.times do |i|
|
file.read.force_encoding("binary")
|
||||||
text << char
|
|
||||||
char.succ!
|
|
||||||
end
|
end
|
||||||
base64_content = [Zlib::Deflate.deflate(text)].pack("m").delete("\n")
|
base64_content = [png].pack("m").delete("\n")
|
||||||
|
|
||||||
[false, true].each do |with_space|
|
[false, true].each do |with_space|
|
||||||
xml_content = base64_content
|
xml_content = base64_content
|
||||||
|
@ -591,7 +587,7 @@ EOA
|
||||||
assert(content.inline_other_base64?)
|
assert(content.inline_other_base64?)
|
||||||
assert(!content.out_of_line?)
|
assert(!content.out_of_line?)
|
||||||
assert(!content.have_xml_content?)
|
assert(!content.have_xml_content?)
|
||||||
assert_equal(text, Zlib::Inflate.inflate(content.content))
|
assert_equal(png, content.content)
|
||||||
|
|
||||||
xml = REXML::Document.new(content.to_s).root
|
xml = REXML::Document.new(content.to_s).root
|
||||||
assert_rexml_element([], {"type" => type}, base64_content, xml)
|
assert_rexml_element([], {"type" => type}, base64_content, xml)
|
||||||
|
|
|
@ -641,24 +641,19 @@ module RSS
|
||||||
|
|
||||||
def assert_atom_content_inline_other_base64_to_s(target_class)
|
def assert_atom_content_inline_other_base64_to_s(target_class)
|
||||||
_wrap_assertion do
|
_wrap_assertion do
|
||||||
require "zlib"
|
type = "image/png"
|
||||||
|
png_file = File.join(File.dirname(__FILE__), "dot.png")
|
||||||
text = ""
|
original_content = File.open(png_file, "rb") do |file|
|
||||||
char = "a"
|
file.read.force_encoding("binary")
|
||||||
100.times do |i|
|
|
||||||
text << char
|
|
||||||
char.succ!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
type = "application/zip"
|
|
||||||
original_content = Zlib::Deflate.deflate(text)
|
|
||||||
|
|
||||||
content = target_class.new
|
content = target_class.new
|
||||||
content.type = type
|
content.type = type
|
||||||
content.content = original_content
|
content.content = original_content
|
||||||
xml = REXML::Document.new(content.to_s).root
|
xml = REXML::Document.new(content.to_s).root
|
||||||
assert_rexml_element([], {"type" => type},
|
assert_rexml_element([], {"type" => type},
|
||||||
[original_content].pack("m").delete("\n"), xml)
|
[original_content].pack("m").delete("\n"),
|
||||||
|
xml)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue