From bac3ea1fca1ed30098e74dd7296836aee413c31a Mon Sep 17 00:00:00 2001 From: kou Date: Mon, 28 Jul 2008 12:33:44 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ test/rss/dot.png | Bin 0 -> 111 bytes test/rss/rss-assertions.rb | 16 ++++++---------- test/rss/test_atom.rb | 17 ++++++----------- 4 files changed, 16 insertions(+), 21 deletions(-) create mode 100644 test/rss/dot.png diff --git a/ChangeLog b/ChangeLog index 100a6734fc..ae5f613793 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jul 28 21:32:17 2008 Kouhei Sutou + + * test/rss/: use PNG instead of zlib as binary data. + Mon Jul 28 21:24:33 2008 NAKAMURA Usaku * thread_win32.[ch] (cond_every_entry, rb_thread_cond_struct): reverted diff --git a/test/rss/dot.png b/test/rss/dot.png new file mode 100644 index 0000000000000000000000000000000000000000..9c6960fa2f9f850f27ea1d8077f71caace320231 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1SBVv2j2ryoCO|{#X#BvjNMLV+kphj3LMjc vG*~sm@u~4|fgB!B7sn8e>&ZX<|F>sg{m1n0&Y8&PKye07S3j3^P6 EOA - text = "" - char = "a" - 100.times do |i| - text << char - char.succ! + png_file = File.join(File.dirname(__FILE__), "dot.png") + png = File.open(png_file, "rb") do |file| + file.read.force_encoding("binary") end - base64_content = [Zlib::Deflate.deflate(text)].pack("m").delete("\n") + base64_content = [png].pack("m").delete("\n") [false, true].each do |with_space| xml_content = base64_content @@ -591,7 +587,7 @@ EOA assert(content.inline_other_base64?) assert(!content.out_of_line?) 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 assert_rexml_element([], {"type" => type}, base64_content, xml) diff --git a/test/rss/test_atom.rb b/test/rss/test_atom.rb index 1f65008fa0..71e0f44ea9 100644 --- a/test/rss/test_atom.rb +++ b/test/rss/test_atom.rb @@ -641,24 +641,19 @@ module RSS def assert_atom_content_inline_other_base64_to_s(target_class) _wrap_assertion do - require "zlib" - - text = "" - char = "a" - 100.times do |i| - text << char - char.succ! + type = "image/png" + png_file = File.join(File.dirname(__FILE__), "dot.png") + original_content = File.open(png_file, "rb") do |file| + file.read.force_encoding("binary") end - type = "application/zip" - original_content = Zlib::Deflate.deflate(text) - content = target_class.new content.type = type content.content = original_content xml = REXML::Document.new(content.to_s).root assert_rexml_element([], {"type" => type}, - [original_content].pack("m").delete("\n"), xml) + [original_content].pack("m").delete("\n"), + xml) end end