git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-01-25 23:12:50 +00:00
Родитель a967f738c8
Коммит 37679ee584
20 изменённых файлов: 77 добавлений и 77 удалений

Просмотреть файл

@ -23,35 +23,35 @@ class TestERB < Test::Unit::TestCase
def test_generate_magic_comment def test_generate_magic_comment
erb = ERB.new("hello") erb = ERB.new("hello")
assert_match /#coding:UTF-8/, erb.src assert_match(/#coding:UTF-8/, erb.src)
erb = ERB.new("hello".force_encoding("EUC-JP")) erb = ERB.new("hello".force_encoding("EUC-JP"))
assert_match /#coding:EUC-JP/, erb.src assert_match(/#coding:EUC-JP/, erb.src)
erb = ERB.new("hello".force_encoding("ISO-8859-9")) erb = ERB.new("hello".force_encoding("ISO-8859-9"))
assert_match /#coding:ISO-8859-9/, erb.src assert_match(/#coding:ISO-8859-9/, erb.src)
end end
def test_literal_encoding def test_literal_encoding
erb = ERB.new("literal encoding is <%= 'hello'.encoding %>") erb = ERB.new("literal encoding is <%= 'hello'.encoding %>")
assert_match /literal encoding is UTF-8/, erb.result assert_match(/literal encoding is UTF-8/, erb.result)
erb = ERB.new("literal encoding is <%= 'こんにちは'.encoding %>".encode("EUC-JP")) erb = ERB.new("literal encoding is <%= 'こんにちは'.encoding %>".encode("EUC-JP"))
assert_match /literal encoding is EUC-JP/, erb.result assert_match(/literal encoding is EUC-JP/, erb.result)
erb = ERB.new("literal encoding is <%= '\xC4\xE3\xBA\xC3'.encoding %>".force_encoding("EUC-CN")) erb = ERB.new("literal encoding is <%= '\xC4\xE3\xBA\xC3'.encoding %>".force_encoding("EUC-CN"))
assert_match /literal encoding is GB2312/, erb.result assert_match(/literal encoding is GB2312/, erb.result)
end end
def test___ENCODING__ def test___ENCODING__
erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>") erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>")
assert_match /__ENCODING__ is UTF-8/, erb.result assert_match(/__ENCODING__ is UTF-8/, erb.result)
erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>".force_encoding("EUC-JP")) erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>".force_encoding("EUC-JP"))
assert_match /__ENCODING__ is EUC-JP/, erb.result assert_match(/__ENCODING__ is EUC-JP/, erb.result)
erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>".force_encoding("Big5")) erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>".force_encoding("Big5"))
assert_match /__ENCODING__ is Big5/, erb.result assert_match(/__ENCODING__ is Big5/, erb.result)
end end
def test_recognize_magic_comment def test_recognize_magic_comment
@ -59,35 +59,35 @@ class TestERB < Test::Unit::TestCase
<%# -*- coding: EUC-KR -*- %> <%# -*- coding: EUC-KR -*- %>
EOS EOS
assert_match /#coding:EUC-KR/, erb.src assert_match(/#coding:EUC-KR/, erb.src)
assert_equal Encoding::EUC_KR, erb.result.encoding assert_equal Encoding::EUC_KR, erb.result.encoding
erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT")) erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT"))
<%#-*- coding: EUC-KR -*-%> <%#-*- coding: EUC-KR -*-%>
EOS EOS
assert_match /#coding:EUC-KR/, erb.src assert_match(/#coding:EUC-KR/, erb.src)
assert_equal Encoding::EUC_KR, erb.result.encoding assert_equal Encoding::EUC_KR, erb.result.encoding
erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT")) erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT"))
<%# vim: tabsize=8 encoding=EUC-KR shiftwidth=2 expandtab %> <%# vim: tabsize=8 encoding=EUC-KR shiftwidth=2 expandtab %>
EOS EOS
assert_match /#coding:EUC-KR/, erb.src assert_match(/#coding:EUC-KR/, erb.src)
assert_equal Encoding::EUC_KR, erb.result.encoding assert_equal Encoding::EUC_KR, erb.result.encoding
erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT")) erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT"))
<%#coding:EUC-KR %> <%#coding:EUC-KR %>
EOS EOS
assert_match /#coding:EUC-KR/, erb.src assert_match(/#coding:EUC-KR/, erb.src)
assert_equal Encoding::EUC_KR, erb.result.encoding assert_equal Encoding::EUC_KR, erb.result.encoding
erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("EUC-JP")) erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("EUC-JP"))
<%#coding:EUC-KR %> <%#coding:EUC-KR %>
EOS EOS
assert_match /#coding:EUC-KR/, erb.src assert_match(/#coding:EUC-KR/, erb.src)
assert_equal Encoding::EUC_KR, erb.result.encoding assert_equal Encoding::EUC_KR, erb.result.encoding
end end
@ -105,8 +105,8 @@ __ENCODING__ is <%= __ENCODING__ %>
result = obj.m_from_magic_comment result = obj.m_from_magic_comment
assert_equal Encoding::EUC_JP, result.encoding assert_equal Encoding::EUC_JP, result.encoding
assert_match /literal encoding is EUC-JP/, result assert_match(/literal encoding is EUC-JP/, result)
assert_match /__ENCODING__ is EUC-JP/, result assert_match(/__ENCODING__ is EUC-JP/, result)
erb = ERB.new(<<-EOS.encode("EUC-KR")) erb = ERB.new(<<-EOS.encode("EUC-KR"))
literal encoding is <%= '안녕하세요'.encoding %> literal encoding is <%= '안녕하세요'.encoding %>
@ -115,8 +115,8 @@ EOS
erb.def_method(M, :m_from_eval_encoding) erb.def_method(M, :m_from_eval_encoding)
result = obj.m_from_eval_encoding result = obj.m_from_eval_encoding
assert_equal Encoding::EUC_KR, result.encoding assert_equal Encoding::EUC_KR, result.encoding
assert_match /literal encoding is EUC-KR/, result assert_match(/literal encoding is EUC-KR/, result)
assert_match /__ENCODING__ is EUC-KR/, result assert_match(/__ENCODING__ is EUC-KR/, result)
end end
end end

Просмотреть файл

@ -571,7 +571,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
ctx_proc = Proc.new do |ctx, ssl| ctx_proc = Proc.new do |ctx, ssl|
foo_ctx = ctx.dup foo_ctx = ctx.dup
ctx.servername_cb = Proc.new do |ssl, hostname| ctx.servername_cb = Proc.new do |ssl2, hostname|
case hostname case hostname
when 'foo.example.com' when 'foo.example.com'
foo_ctx foo_ctx

Просмотреть файл

@ -366,11 +366,11 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
thru_mlhs_add_star = false thru_mlhs_add_star = false
tree = parse("a, *b = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} tree = parse("a, *b = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
assert_equal true, thru_mlhs_add_star assert_equal true, thru_mlhs_add_star
assert_match /mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\)/, tree assert_match(/mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\)/, tree)
thru_mlhs_add_star = false thru_mlhs_add_star = false
tree = parse("a, *b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} tree = parse("a, *b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true}
assert_equal true, thru_mlhs_add_star assert_equal true, thru_mlhs_add_star
assert_match /mlhs_add\(mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug2232 assert_match(/mlhs_add\(mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug2232)
end end
def test_mlhs_new def test_mlhs_new

Просмотреть файл

@ -64,7 +64,7 @@ class TestBasicInstructions < Test::Unit::TestCase
end end
def test_regexp def test_regexp
assert_equal /test/, /test/ assert_equal(/test/, /test/)
assert_equal 'test', /test/.source assert_equal 'test', /test/.source
assert_equal 'TEST', /TEST/.source assert_equal 'TEST', /TEST/.source
assert_equal true, !!(/test/ =~ 'test') assert_equal true, !!(/test/ =~ 'test')
@ -76,9 +76,9 @@ class TestBasicInstructions < Test::Unit::TestCase
assert_equal true, !!(re =~ 'test') assert_equal true, !!(re =~ 'test')
assert_equal false, !!(re =~ 'does not match') assert_equal false, !!(re =~ 'does not match')
assert_equal /x#{1+1}x/, /x#{1+1}x/ assert_equal(/x#{1+1}x/, /x#{1+1}x/)
s = "OK" s = "OK"
assert_equal /x#{s}x/, /x#{s}x/ assert_equal(/x#{s}x/, /x#{s}x/)
assert_equal true, !!(/x#{s}x/ =~ "xOKx") assert_equal true, !!(/x#{s}x/ =~ "xOKx")
assert_equal false, !!(/x#{s}x/ =~ "does not match") assert_equal false, !!(/x#{s}x/ =~ "does not match")

Просмотреть файл

@ -80,8 +80,8 @@ EOW
'-e', 'raise %[SomethingElse]']) {|f| '-e', 'raise %[SomethingElse]']) {|f|
f.read f.read
} }
assert_match /SomethingBad/, out, "[ruby-core:9675]" assert_match(/SomethingBad/, out, "[ruby-core:9675]")
assert_match /SomethingElse/, out, "[ruby-core:9675]" assert_match(/SomethingElse/, out, "[ruby-core:9675]")
end end
def test_should_propagate_exit_code def test_should_propagate_exit_code
@ -99,7 +99,7 @@ EOW
'-e', 'at_exit{Process.kill(:INT, $$); loop{}}']) {|f| '-e', 'at_exit{Process.kill(:INT, $$); loop{}}']) {|f|
f.read f.read
} }
assert_match /Interrupt$/, out assert_match(/Interrupt$/, out)
Process.kill(0, 0) rescue return # check if signal works Process.kill(0, 0) rescue return # check if signal works
assert_nil $?.exitstatus assert_nil $?.exitstatus
assert_equal Signal.list["INT"], $?.termsig assert_equal Signal.list["INT"], $?.termsig

Просмотреть файл

@ -143,27 +143,27 @@ class TestEnumerable < Test::Unit::TestCase
def test_min def test_min
assert_equal(1, @obj.min) assert_equal(1, @obj.min)
assert_equal(3, @obj.min {|a,b| b <=> a }) assert_equal(3, @obj.min {|a,b| b <=> a })
a = %w(albatross dog horse) ary = %w(albatross dog horse)
assert_equal("albatross", a.min) assert_equal("albatross", ary.min)
assert_equal("dog", a.min {|a,b| a.length <=> b.length }) assert_equal("dog", ary.min {|a,b| a.length <=> b.length })
assert_equal(1, [3,2,1].min) assert_equal(1, [3,2,1].min)
end end
def test_max def test_max
assert_equal(3, @obj.max) assert_equal(3, @obj.max)
assert_equal(1, @obj.max {|a,b| b <=> a }) assert_equal(1, @obj.max {|a,b| b <=> a })
a = %w(albatross dog horse) ary = %w(albatross dog horse)
assert_equal("horse", a.max) assert_equal("horse", ary.max)
assert_equal("albatross", a.max {|a,b| a.length <=> b.length }) assert_equal("albatross", ary.max {|a,b| a.length <=> b.length })
assert_equal(1, [3,2,1].max{|a,b| b <=> a }) assert_equal(1, [3,2,1].max{|a,b| b <=> a })
end end
def test_minmax def test_minmax
assert_equal([1, 3], @obj.minmax) assert_equal([1, 3], @obj.minmax)
assert_equal([3, 1], @obj.minmax {|a,b| b <=> a }) assert_equal([3, 1], @obj.minmax {|a,b| b <=> a })
a = %w(albatross dog horse) ary = %w(albatross dog horse)
assert_equal(["albatross", "horse"], a.minmax) assert_equal(["albatross", "horse"], ary.minmax)
assert_equal(["dog", "albatross"], a.minmax {|a,b| a.length <=> b.length }) assert_equal(["dog", "albatross"], ary.minmax {|a,b| a.length <=> b.length })
assert_equal([1, 3], [2,3,1].minmax) assert_equal([1, 3], [2,3,1].minmax)
assert_equal([3, 1], [2,3,1].minmax {|a,b| b <=> a }) assert_equal([3, 1], [2,3,1].minmax {|a,b| b <=> a })
assert_equal([1, 3], [2,2,3,3,1,1].minmax) assert_equal([1, 3], [2,2,3,3,1,1].minmax)

Просмотреть файл

@ -140,13 +140,13 @@ class TestFile < Test::Unit::TestCase
end end
def test_s_chown def test_s_chown
assert_nothing_raised { File.chown -1, -1 } assert_nothing_raised { File.chown(-1, -1) }
assert_nothing_raised { File.chown nil, nil } assert_nothing_raised { File.chown nil, nil }
end end
def test_chown def test_chown
assert_nothing_raised { assert_nothing_raised {
File.open(__FILE__) {|f| f.chown -1, -1 } File.open(__FILE__) {|f| f.chown(-1, -1) }
} }
assert_nothing_raised("[ruby-dev:27140]") { assert_nothing_raised("[ruby-dev:27140]") {
File.open(__FILE__) {|f| f.chown nil, nil } File.open(__FILE__) {|f| f.chown nil, nil }

Просмотреть файл

@ -492,7 +492,7 @@ class TestFileExhaustive < Test::Unit::TestCase
f.close f.close
make_file("foo", @file) make_file("foo", @file)
assert_raise(IOError) { File.open(@file) {|f| f.truncate(0)} } assert_raise(IOError) { File.open(@file) {|ff| ff.truncate(0)} }
rescue NotImplementedError rescue NotImplementedError
end end

Просмотреть файл

@ -51,7 +51,7 @@ class TestHash < Test::Unit::TestCase
assert_equal([], x[22]) assert_equal([], x[22])
assert_not_same(x[22], x[22]) assert_not_same(x[22], x[22])
x = Hash.new{|h,k| z = k; h[k] = k*2} x = Hash.new{|h,kk| z = kk; h[kk] = kk*2}
z = 0 z = 0
assert_equal(44, x[22]) assert_equal(44, x[22])
assert_equal(22, z) assert_equal(22, z)
@ -703,14 +703,14 @@ class TestHash < Test::Unit::TestCase
end end
def test_default_proc def test_default_proc
h = Hash.new {|h, k| h + k + "baz" } h = Hash.new {|hh, k| hh + k + "baz" }
assert_equal("foobarbaz", h.default_proc.call("foo", "bar")) assert_equal("foobarbaz", h.default_proc.call("foo", "bar"))
h = {} h = {}
assert_nil(h.default_proc) assert_nil(h.default_proc)
end end
def test_shift2 def test_shift2
h = Hash.new {|h, k| :foo } h = Hash.new {|hh, k| :foo }
h[1] = 2 h[1] = 2
assert_equal([1, 2], h.shift) assert_equal([1, 2], h.shift)
assert_equal(:foo, h.shift) assert_equal(:foo, h.shift)

Просмотреть файл

@ -150,10 +150,10 @@ class TestInteger < Test::Unit::TestCase
1.upto(0) {|x| a << x } 1.upto(0) {|x| a << x }
assert_equal([], a) assert_equal([], a)
x = 2**30 - 1 y = 2**30 - 1
a = [] a = []
x.upto(x+2) {|x| a << x } y.upto(y+2) {|x| a << x }
assert_equal([x, x+1, x+2], a) assert_equal([y, y+1, y+2], a)
end end
def test_downto def test_downto
@ -165,10 +165,10 @@ class TestInteger < Test::Unit::TestCase
1.downto(2) {|x| a << x } 1.downto(2) {|x| a << x }
assert_equal([], a) assert_equal([], a)
x = -(2**30) y = -(2**30)
a = [] a = []
x.downto(x-2) {|x| a << x } y.downto(y-2) {|x| a << x }
assert_equal([x, x-1, x-2], a) assert_equal([y, y-1, y-2], a)
end end
def test_times def test_times

Просмотреть файл

@ -5,8 +5,8 @@ class Array
collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]} collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]}
end end
def iter_test2 def iter_test2
a = collect{|e| [e, yield(e)]} ary = collect{|e| [e, yield(e)]}
a.sort{|a,b|a[1]<=>b[1]} ary.sort{|a,b|a[1]<=>b[1]}
end end
end end
@ -51,7 +51,7 @@ class TestIterator < Test::Unit::TestCase
def test_nested_iterator def test_nested_iterator
i = 0 i = 0
tt{|i| break if i == 5} tt{|j| break if j == 5}
assert_equal(0, i) assert_equal(0, i)
assert_raise(ArgumentError) do assert_raise(ArgumentError) do

Просмотреть файл

@ -77,16 +77,16 @@ class TestRubyLiteral < Test::Unit::TestCase
def test_regexp def test_regexp
assert_instance_of Regexp, // assert_instance_of Regexp, //
assert_match //, 'a' assert_match(//, 'a')
assert_match //, '' assert_match(//, '')
assert_instance_of Regexp, /a/ assert_instance_of Regexp, /a/
assert_match /a/, 'a' assert_match(/a/, 'a')
assert_no_match /test/, 'tes' assert_no_match(/test/, 'tes')
re = /test/ re = /test/
assert_match re, 'test' assert_match re, 'test'
str = 'test' str = 'test'
assert_match re, str assert_match re, str
assert_match /test/, str assert_match(/test/, str)
assert_equal 0, (/test/ =~ 'test') assert_equal 0, (/test/ =~ 'test')
assert_equal 0, (re =~ 'test') assert_equal 0, (re =~ 'test')
assert_equal 0, (/test/ =~ str) assert_equal 0, (/test/ =~ str)

Просмотреть файл

@ -178,7 +178,7 @@ class TestProc < Test::Unit::TestCase
b = proc { :foo } b = proc { :foo }
assert_equal(:foo, b.curry[]) assert_equal(:foo, b.curry[])
b = lambda {|x, y, &b| b.call(x + y) }.curry b = lambda {|x, y, &blk| blk.call(x + y) }.curry
b = b.call(2) { raise } b = b.call(2) { raise }
b = b.call(3) {|x| x + 4 } b = b.call(3) {|x| x + 4 }
assert_equal(9, b) assert_equal(9, b)

Просмотреть файл

@ -229,7 +229,7 @@ class TestSprintfComb < Test::Unit::TestCase
digits.reverse! digits.reverse!
str = digits.map {|d| digitmap[d] }.join str = digits.map {|digit| digitmap[digit] }.join
pad = '' pad = ''
nlen = prefix.length + sign.length + str.length nlen = prefix.length + sign.length + str.length

Просмотреть файл

@ -190,8 +190,8 @@ class TestOpen3 < Test::Unit::TestCase
ts.each {|t| assert_kind_of(Thread, t) } ts.each {|t| assert_kind_of(Thread, t) }
i.print str i.print str
i.close i.close
ts.each_with_index {|t, i| ts.each_with_index {|t, ii|
assert_equal(str[i] == ?t, t.value.success?) assert_equal(str[ii] == ?t, t.value.success?)
} }
} }
end end

Просмотреть файл

@ -107,7 +107,7 @@ class TestPrime < Test::Unit::TestCase
def test_from_prime_division def test_from_prime_division
assert_equal PRIMES.inject(&:*), Integer.from_prime_division(PRIMES.map{|p| [p,1]}) assert_equal PRIMES.inject(&:*), Integer.from_prime_division(PRIMES.map{|p| [p,1]})
assert_equal -PRIMES.inject(&:*), Integer.from_prime_division([[-1, 1]] + PRIMES.map{|p| [p,1]}) assert_equal(-PRIMES.inject(&:*), Integer.from_prime_division([[-1, 1]] + PRIMES.map{|p| [p,1]}))
end end
def test_prime? def test_prime?
@ -124,11 +124,11 @@ class TestPrime < Test::Unit::TestCase
assert !9.prime? assert !9.prime?
# mersenne numbers # mersenne numbers
assert (2**31-1).prime? assert((2**31-1).prime?)
assert !(2**32-1).prime? assert !(2**32-1).prime?
# fermat numbers # fermat numbers
assert (2**(2**4)+1).prime? assert((2**(2**4)+1).prime?)
assert !(2**(2**5)+1).prime? # Euler! assert !(2**(2**5)+1).prime? # Euler!
# large composite # large composite
@ -139,8 +139,8 @@ class TestPrime < Test::Unit::TestCase
# negative # negative
assert !-1.prime? assert !-1.prime?
assert -2.prime? assert(-2.prime?)
assert -3.prime? assert(-3.prime?)
assert !-4.prime? assert !-4.prime?
end end
end end

Просмотреть файл

@ -81,8 +81,8 @@ class TestLDAP < Test::Unit::TestCase
['ldap', nil, URI::LDAP::DEFAULT_PORT, ['ldap', nil, URI::LDAP::DEFAULT_PORT,
'', '',
nil, 'sub', nil, '!bindname=cn=Manager%2co=Foo'], nil, 'sub', nil, '!bindname=cn=Manager%2co=Foo'],
}.each do |url, ary| }.each do |url2, ary|
u = URI.parse(url) u = URI.parse(url2)
assert_equal(ary, uri_to_ary(u)) assert_equal(ary, uri_to_ary(u))
end end
end end

Просмотреть файл

@ -254,8 +254,8 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase
:SSLPrivateKey => key, :SSLPrivateKey => key,
} }
TestWEBrick.start_httpserver(s_config){|s_server, s_addr, s_port, s_log| TestWEBrick.start_httpserver(s_config){|s_server, s_addr, s_port, s_log|
s_server.mount_proc("/"){|req, res| s_server.mount_proc("/"){|req2, res|
res.body = "SSL #{req.request_method} #{req.path} #{req.body}" res.body = "SSL #{req2.request_method} #{req2.path} #{req2.body}"
} }
http = Net::HTTP.new("127.0.0.1", s_port, addr, port, up_log.call + log.call + s_log.call) http = Net::HTTP.new("127.0.0.1", s_port, addr, port, up_log.call + log.call + s_log.call)
http.use_ssl = true http.use_ssl = true
@ -263,14 +263,14 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase
store_ctx.current_cert.to_der == cert.to_der store_ctx.current_cert.to_der == cert.to_der
end end
req = Net::HTTP::Get.new("/") req2 = Net::HTTP::Get.new("/")
http.request(req){|res| http.request(req2){|res|
assert_equal("SSL GET / ", res.body, up_log.call + log.call + s_log.call) assert_equal("SSL GET / ", res.body, up_log.call + log.call + s_log.call)
} }
req = Net::HTTP::Post.new("/") req2 = Net::HTTP::Post.new("/")
req.body = "post-data" req2.body = "post-data"
http.request(req){|res| http.request(req2){|res|
assert_equal("SSL POST / post-data", res.body, up_log.call + log.call + s_log.call) assert_equal("SSL POST / post-data", res.body, up_log.call + log.call + s_log.call)
} }
} }

Просмотреть файл

@ -88,11 +88,11 @@ class Test_Webrick < Test::Unit::TestCase
# default handler (missing handler) # default handler (missing handler)
ok, param = @s.call2('test.nonexisting') ok, param = @s.call2('test.nonexisting')
assert_equal false, ok assert_equal false, ok
assert_equal -99, param.faultCode assert_equal(-99, param.faultCode)
# default handler (wrong number of arguments) # default handler (wrong number of arguments)
ok, param = @s.call2('test.add', 1, 2, 3) ok, param = @s.call2('test.add', 1, 2, 3)
assert_equal false, ok assert_equal false, ok
assert_equal -99, param.faultCode assert_equal(-99, param.faultCode)
end end
end end

Просмотреть файл

@ -7,7 +7,7 @@ module WEBrick_Testing
end end
def start_server(config={}) def start_server(config={})
raise "already started" if @__server raise "already started" if defined?(@__server) && @__server
@__started = false @__started = false
@__server_thread = Thread.new { @__server_thread = Thread.new {