mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
2acc30eead
commit
c4f3a04cc1
1 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue