From c4f3a04cc1a8cf088afe85660953839b5bf078ea Mon Sep 17 00:00:00 2001 From: tarui Date: Fri, 11 Jun 2010 21:34:44 +0000 Subject: * test/open-uri/test_open-uri.rb (test_progress, test_progress_chunked): 'size' is a accumulated transferred size in bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/open-uri/test_open-uri.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/open-uri') diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb index 5c1031b231..e2578f09b4 100644 --- a/test/open-uri/test_open-uri.rb +++ b/test/open-uri/test_open-uri.rb @@ -379,7 +379,7 @@ class TestOpenURI < Test::Unit::TestCase def test_progress with_http {|srv, dr, url| - content = "a" * 10000 + content = "a" * 100000 srv.mount_proc("/data/") {|req, res| res.body = content } length = [] progress = [] @@ -389,7 +389,9 @@ class TestOpenURI < Test::Unit::TestCase ) {|f| assert_equal(1, length.length) assert_equal(content.length, length[0]) - assert_equal(content.length, progress.inject(&:+)) + assert(progress.length>1,"maybe test is worng") + assert(progress.sort == progress,"monotone increasing expected but was\n#{progress.inspect}") + assert_equal(content.length, progress[-1]) assert_equal(content, f.read) } } @@ -397,7 +399,7 @@ class TestOpenURI < Test::Unit::TestCase def test_progress_chunked with_http {|srv, dr, url| - content = "a" * 10000 + content = "a" * 100000 srv.mount_proc("/data/") {|req, res| res.body = content; res.chunked = true } length = [] progress = [] @@ -407,7 +409,9 @@ class TestOpenURI < Test::Unit::TestCase ) {|f| assert_equal(1, length.length) assert_equal(nil, length[0]) - assert_equal(content.length, progress.inject(&:+)) + assert(progress.length>1,"maybe test is worng") + assert(progress.sort == progress,"monotone increasing expected but was\n#{progress.inspect}") + assert_equal(content.length, progress[-1]) assert_equal(content, f.read) } } -- cgit v1.2.3