summaryrefslogtreecommitdiff
path: root/test/open-uri/test_open-uri.rb
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-11 21:34:44 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-11 21:34:44 +0000
commitc4f3a04cc1a8cf088afe85660953839b5bf078ea (patch)
tree3152b399d8ba9f624b8233d0ad2d043e1597c9a1 /test/open-uri/test_open-uri.rb
parent2acc30eead0f8653c7266e0d9365ece41f2f458f (diff)
* 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
Diffstat (limited to 'test/open-uri/test_open-uri.rb')
-rw-r--r--test/open-uri/test_open-uri.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 5c1031b..e2578f0 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)
}
}