1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

use ML ref. for assertion message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-11-18 07:18:56 +00:00
parent c719cd9b46
commit 68543f3092
22 changed files with 92 additions and 115 deletions

View file

@ -326,14 +326,13 @@ end
assert_same_file fname, 'tmp/mvdest' assert_same_file fname, 'tmp/mvdest'
end end
# [ruby-talk:124368]
mkdir 'tmp/tmpdir' mkdir 'tmp/tmpdir'
mkdir_p 'tmp/dest2/tmpdir' mkdir_p 'tmp/dest2/tmpdir'
assert_raises(Errno::EEXIST) { assert_raises(Errno::EEXIST) {
mv 'tmp/tmpdir', 'tmp/dest2' mv 'tmp/tmpdir', 'tmp/dest2'
} }
mkdir 'tmp/dest2/tmpdir/junk' mkdir 'tmp/dest2/tmpdir/junk'
assert_raises(Errno::EEXIST) { assert_raises(Errno::EEXIST, "[ruby-talk:124368]") {
mv 'tmp/tmpdir', 'tmp/dest2' mv 'tmp/tmpdir', 'tmp/dest2'
} }

View file

@ -6,7 +6,7 @@ end
Thread.abort_on_exception = true Thread.abort_on_exception = true
class TestIONonblock < Test::Unit::TestCase class TestIONonblock < Test::Unit::TestCase
def test_flush # [ruby-dev:24985] def test_flush
flunk "IO#close can't interrupt IO blocking on YARV" flunk "IO#close can't interrupt IO blocking on YARV"
r,w = IO.pipe r,w = IO.pipe
w.nonblock = true w.nonblock = true
@ -24,7 +24,7 @@ class TestIONonblock < Test::Unit::TestCase
result << s result << s
end end
} }
assert_raise(IOError) {w.flush} assert_raise(IOError, "[ruby-dev:24985]") {w.flush}
assert_nothing_raised {t.join} assert_nothing_raised {t.join}
assert_equal(4097, result.size) assert_equal(4097, result.size)
end end

View file

@ -54,15 +54,14 @@ EOW
end end
def test_raise_in_at_exit def test_raise_in_at_exit
# [ruby-core:09675]
ruby = EnvUtil.rubybin ruby = EnvUtil.rubybin
out = IO.popen([ruby, '-e', 'STDERR.reopen(STDOUT)', out = IO.popen([ruby, '-e', 'STDERR.reopen(STDOUT)',
'-e', 'at_exit{raise %[SomethingBad]}', '-e', 'at_exit{raise %[SomethingBad]}',
'-e', 'raise %[SomethingElse]']) {|f| '-e', 'raise %[SomethingElse]']) {|f|
f.read f.read
} }
assert_match /SomethingBad/, out assert_match /SomethingBad/, out, "[ruby-core:9675]"
assert_match /SomethingElse/, out assert_match /SomethingElse/, out, "[ruby-core:9675]"
end end
def test_should_propagate_exit_code def test_should_propagate_exit_code

View file

@ -85,13 +85,13 @@ class TestBignum < Test::Unit::TestCase
shift_test(-0xfffffffffffffffff) shift_test(-0xfffffffffffffffff)
end end
def test_to_s # [ruby-core:10686] def test_to_s
assert_equal("fvvvvvvvvvvvv" ,18446744073709551615.to_s(32)) assert_equal("fvvvvvvvvvvvv" ,18446744073709551615.to_s(32), "[ruby-core:10686]")
assert_equal("g000000000000" ,18446744073709551616.to_s(32)) assert_equal("g000000000000" ,18446744073709551616.to_s(32), "[ruby-core:10686]")
assert_equal("3w5e11264sgsf" ,18446744073709551615.to_s(36)) assert_equal("3w5e11264sgsf" ,18446744073709551615.to_s(36), "[ruby-core:10686]")
assert_equal("3w5e11264sgsg" ,18446744073709551616.to_s(36)) assert_equal("3w5e11264sgsg" ,18446744073709551616.to_s(36), "[ruby-core:10686]")
assert_equal("nd075ib45k86f" ,18446744073709551615.to_s(31)) assert_equal("nd075ib45k86f" ,18446744073709551615.to_s(31), "[ruby-core:10686]")
assert_equal("nd075ib45k86g" ,18446744073709551616.to_s(31)) assert_equal("nd075ib45k86g" ,18446744073709551616.to_s(31), "[ruby-core:10686]")
assert_equal("1777777777777777777777" ,18446744073709551615.to_s(8)) assert_equal("1777777777777777777777" ,18446744073709551615.to_s(8))
assert_equal("-1777777777777777777777" ,-18446744073709551615.to_s(8)) assert_equal("-1777777777777777777777" ,-18446744073709551615.to_s(8))
end end

View file

@ -338,30 +338,30 @@ class TestEval < Test::Unit::TestCase
end end
end end
def test_nil_instance_eval_cvar # [ruby-dev:24103] def test_nil_instance_eval_cvar
def nil.test_binding def nil.test_binding
binding binding
end end
bb = eval("nil.instance_eval \"binding\"", nil.test_binding) bb = eval("nil.instance_eval \"binding\"", nil.test_binding)
assert_raise(NameError) { eval("@@a", bb) } assert_raise(NameError, "[ruby-dev:24103]") { eval("@@a", bb) }
class << nil class << nil
remove_method :test_binding remove_method :test_binding
end end
end end
def test_fixnum_instance_eval_cvar # [ruby-dev:24213] def test_fixnum_instance_eval_cvar
assert_raise(NameError) { 1.instance_eval "@@a" } assert_raise(NameError, "[ruby-dev:24213]") { 1.instance_eval "@@a" }
end end
def test_cvar_scope_with_instance_eval # [ruby-dev:24223] def test_cvar_scope_with_instance_eval
Fixnum.class_eval "@@test_cvar_scope_with_instance_eval = 1" # depends on [ruby-dev:24229] Fixnum.class_eval "@@test_cvar_scope_with_instance_eval = 1" # depends on [ruby-dev:24229]
@@test_cvar_scope_with_instance_eval = 4 @@test_cvar_scope_with_instance_eval = 4
assert_equal(4, 1.instance_eval("@@test_cvar_scope_with_instance_eval")) assert_equal(4, 1.instance_eval("@@test_cvar_scope_with_instance_eval"), "[ruby-dev:24223]")
Fixnum.__send__(:remove_class_variable, :@@test_cvar_scope_with_instance_eval) Fixnum.__send__(:remove_class_variable, :@@test_cvar_scope_with_instance_eval)
end end
def test_eval_and_define_method # [ruby-dev:24228] def test_eval_and_define_method
assert_nothing_raised { assert_nothing_raised("[ruby-dev:24228]") {
def temporally_method_for_test_eval_and_define_method(&block) def temporally_method_for_test_eval_and_define_method(&block)
lambda { lambda {
class << Object.new; self end.send(:define_method, :zzz, &block) class << Object.new; self end.send(:define_method, :zzz, &block)

View file

@ -37,16 +37,16 @@ class TestFile < Test::Unit::TestCase
include TestEOF::Seek include TestEOF::Seek
def test_truncate_wbuf # [ruby-dev:24191] def test_truncate_wbuf
f = Tempfile.new("test-truncate") f = Tempfile.new("test-truncate")
f.print "abc" f.print "abc"
f.truncate(0) f.truncate(0)
f.print "def" f.print "def"
f.close f.close
assert_equal("\0\0\0def", File.read(f.path)) assert_equal("\0\0\0def", File.read(f.path), "[ruby-dev:24191]")
end end
def test_truncate_rbuf # [ruby-dev:24197] def test_truncate_rbuf
f = Tempfile.new("test-truncate") f = Tempfile.new("test-truncate")
f.puts "abc" f.puts "abc"
f.puts "def" f.puts "def"
@ -54,7 +54,7 @@ class TestFile < Test::Unit::TestCase
f.open f.open
assert_equal("abc\n", f.gets) assert_equal("abc\n", f.gets)
f.truncate(3) f.truncate(3)
assert_equal(nil, f.gets) assert_equal(nil, f.gets, "[ruby-dev:24197]")
end end
def test_truncate_beyond_eof def test_truncate_beyond_eof
@ -110,8 +110,7 @@ class TestFile < Test::Unit::TestCase
assert_nothing_raised { assert_nothing_raised {
File.open(__FILE__) {|f| f.chown -1, -1 } File.open(__FILE__) {|f| f.chown -1, -1 }
} }
# [ruby-dev:27140] assert_nothing_raised("[ruby-dev:27140]") {
assert_nothing_raised {
File.open(__FILE__) {|f| f.chown nil, nil } File.open(__FILE__) {|f| f.chown nil, nil }
} }
end end

View file

@ -10,9 +10,8 @@ class TestFnmatch < Test::Unit::TestCase
end end
end end
def test_fnmatch def test_fnmatch
# from [ruby-dev:22815] and [ruby-dev:22819] assert(File.fnmatch('\[1\]' , '[1]'), "[ruby-dev:22819]")
assert(File.fnmatch('\[1\]' , '[1]')) assert(File.fnmatch('*?', 'a'), "[ruby-dev:22815]")
assert(File.fnmatch('*?', 'a'))
assert(File.fnmatch('*/', 'a/')) assert(File.fnmatch('*/', 'a/'))
assert(File.fnmatch('\[1\]' , '[1]', File::FNM_PATHNAME)) assert(File.fnmatch('\[1\]' , '[1]', File::FNM_PATHNAME))
assert(File.fnmatch('*?', 'a', File::FNM_PATHNAME)) assert(File.fnmatch('*?', 'a', File::FNM_PATHNAME))

View file

@ -156,12 +156,11 @@ class TestInteger < Test::Unit::TestCase
} }
} }
# [ruby-dev:31271] # assert_equal(1, (1 << 0x40000000)[0x40000000], "[ruby-dev:31271]")
# assert_equal(1, (1 << 0x40000000)[0x40000000]) # assert_equal(0, (-1 << 0x40000001)[0x40000000], "[ruby-dev:31271]")
# assert_equal(0, (-1 << 0x40000001)[0x40000000])
big_zero = 0x40000000.coerce(0)[0] big_zero = 0x40000000.coerce(0)[0]
assert_equal(0, (-0x40000002)[big_zero]) assert_equal(0, (-0x40000002)[big_zero], "[ruby-dev:31271]")
assert_equal(1, 0x400000001[big_zero]) assert_equal(1, 0x400000001[big_zero], "[ruby-dev:31271]")
end end
def test_plus def test_plus

View file

@ -19,18 +19,18 @@ class TestIO < Test::Unit::TestCase
assert_nil r.gets("") assert_nil r.gets("")
r.close r.close
# "\377" [ruby-dev:24460] # "\377"
r, w = IO.pipe r, w = IO.pipe
w.print "\377xyz" w.print "\377xyz"
w.close w.close
assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]") assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]")
r.close r.close
# "" [ruby-core:03771] # ""
r, w = IO.pipe r, w = IO.pipe
w.print "a\n\nb\n\n" w.print "a\n\nb\n\n"
w.close w.close
assert_equal "a\n\n", r.gets("") assert_equal "a\n\n", r.gets(""), "[ruby-core:03771]"
assert_equal "b\n\n", r.gets("") assert_equal "b\n\n", r.gets("")
assert_nil r.gets("") assert_nil r.gets("")
r.close r.close

View file

@ -44,13 +44,13 @@ class TestPath < Test::Unit::TestCase
assert_equal("//sub", File.expand_path("sub", "//")) assert_equal("//sub", File.expand_path("sub", "//"))
end end
def test_dirname # [ruby-dev:27738] def test_dirname
if /(bcc|ms)win\d|mingw|cygwin|djgpp|human|emx/ =~ RUBY_PLATFORM if /(bcc|ms)win\d|mingw|cygwin|djgpp|human|emx/ =~ RUBY_PLATFORM
# DOSISH_DRIVE_LETTER # DOSISH_DRIVE_LETTER
assert_equal('C:.', File.dirname('C:')) assert_equal('C:.', File.dirname('C:'))
assert_equal('C:.', File.dirname('C:a')) assert_equal('C:.', File.dirname('C:a'))
assert_equal('C:.', File.dirname('C:a/')) assert_equal('C:.', File.dirname('C:a/'))
assert_equal('C:a', File.dirname('C:a/b')) assert_equal('C:a', File.dirname('C:a/b'), "[ruby-dev:27738]")
assert_equal('C:/', File.dirname('C:/')) assert_equal('C:/', File.dirname('C:/'))
assert_equal('C:/', File.dirname('C:/a')) assert_equal('C:/', File.dirname('C:/a'))
@ -62,7 +62,7 @@ class TestPath < Test::Unit::TestCase
assert_equal('C:/', File.dirname('C://a/')) assert_equal('C:/', File.dirname('C://a/'))
assert_equal('C:/a', File.dirname('C://a/b')) assert_equal('C:/a', File.dirname('C://a/b'))
assert_equal('C:/', File.dirname('C:///')) assert_equal('C:/', File.dirname('C:///'), "[ruby-dev:27738]")
assert_equal('C:/', File.dirname('C:///a')) assert_equal('C:/', File.dirname('C:///a'))
assert_equal('C:/', File.dirname('C:///a/')) assert_equal('C:/', File.dirname('C:///a/'))
assert_equal('C:/a', File.dirname('C:///a/b')) assert_equal('C:/a', File.dirname('C:///a/b'))
@ -134,7 +134,7 @@ class TestPath < Test::Unit::TestCase
end end
end end
def test_basename # [ruby-dev:27766] def test_basename
if /(bcc|ms)win\d|mingw|cygwin|djgpp|human|emx/ =~ RUBY_PLATFORM if /(bcc|ms)win\d|mingw|cygwin|djgpp|human|emx/ =~ RUBY_PLATFORM
# DOSISH_DRIVE_LETTER # DOSISH_DRIVE_LETTER
assert_equal('', File.basename('C:')) assert_equal('', File.basename('C:'))
@ -194,7 +194,7 @@ class TestPath < Test::Unit::TestCase
assert_equal('/', File.basename('//')) assert_equal('/', File.basename('//'))
assert_equal('/', File.basename('//a')) assert_equal('/', File.basename('//a'))
assert_equal('/', File.basename('//a/')) assert_equal('/', File.basename('//a/'))
assert_equal('/', File.basename('//a/b')) assert_equal('/', File.basename('//a/b'), "[ruby-dev:27776]")
assert_equal('/', File.basename('//a/b/')) assert_equal('/', File.basename('//a/b/'))
assert_equal('c', File.basename('//a/b/c')) assert_equal('c', File.basename('//a/b/c'))

View file

@ -70,25 +70,21 @@ class TestProc < Test::Unit::TestCase
assert_arity(-1) {|*|} assert_arity(-1) {|*|}
end end
# [ruby-dev:22592]
def m(x) def m(x)
lambda { x } lambda { x }
end end
def test_eq def test_eq
# [ruby-dev:22592]
a = m(1) a = m(1)
b = m(2) b = m(2)
assert_not_equal(a, b) assert_not_equal(a, b, "[ruby-dev:22592]")
assert_not_equal(a.call, b.call) assert_not_equal(a.call, b.call, "[ruby-dev:22592]")
# [ruby-dev:22599] assert_not_equal(proc {||}, proc {|x,y|}, "[ruby-dev:22599]")
assert_not_equal(proc {||}, proc {|x,y|})
# [ruby-dev:22601]
a = lambda {|x| lambda {} }.call(1) a = lambda {|x| lambda {} }.call(1)
b = lambda {} b = lambda {}
assert_not_equal(a, b) assert_not_equal(a, b, "[ruby-dev:22601]")
end end
def test_block_par def test_block_par

View file

@ -144,35 +144,30 @@ class TestSprintf < Test::Unit::TestCase
end end
def test_invalid def test_invalid
# [ruby-core:11569]
# Star precision before star width: # Star precision before star width:
assert_raise(ArgumentError) {sprintf("%.**d", 5, 10, 1)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.**d", 5, 10, 1)}
# Precision before flags and width: # Precision before flags and width:
assert_raise(ArgumentError) {sprintf("%.5+05d", 5)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.5+05d", 5)}
assert_raise(ArgumentError) {sprintf("%.5 5d", 5)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.5 5d", 5)}
# Overriding a star width with a numeric one: # Overriding a star width with a numeric one:
assert_raise(ArgumentError) {sprintf("%*1s", 5, 1)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%*1s", 5, 1)}
# Width before flags: # Width before flags:
assert_raise(ArgumentError) {sprintf("%5+0d", 1)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%5+0d", 1)}
assert_raise(ArgumentError) {sprintf("%5 0d", 1)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%5 0d", 1)}
# Specifying width multiple times: # Specifying width multiple times:
assert_raise(ArgumentError) {sprintf("%50+30+20+10+5d", 5)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%50+30+20+10+5d", 5)}
assert_raise(ArgumentError) {sprintf("%50 30 20 10 5d", 5)} assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%50 30 20 10 5d", 5)}
# [ruby-core:11570]
# Specifying the precision multiple times with negative star arguments: # Specifying the precision multiple times with negative star arguments:
assert_raise(ArgumentError) {sprintf("%.*.*.*.*f", -1, -1, -1, 5, 1)} assert_raise(ArgumentError, "[ruby-core:11570]") {sprintf("%.*.*.*.*f", -1, -1, -1, 5, 1)}
# [ruby-core:11571]
# Null bytes after percent signs are removed: # Null bytes after percent signs are removed:
assert_equal("%\0x hello", sprintf("%\0x hello")) assert_equal("%\0x hello", sprintf("%\0x hello"), "[ruby-core:11571]")
# [ruby-core:11573] assert_raise(ArgumentError, "[ruby-core:11573]") {sprintf("%.25555555555555555555555555555555555555s", "hello")}
assert_raise(ArgumentError) {sprintf("%.25555555555555555555555555555555555555s", "hello")}
end end
end end

View file

@ -126,9 +126,9 @@ class TestSuper < Test::Unit::TestCase
end end
end end
def test_define_method # [ruby-core:03856] def test_define_method
a = A.new a = A.new
a.uu(12) a.uu(12)
assert_equal("A#tt", a.tt(12)) assert_equal("A#tt", a.tt(12), "[ruby-core:3856]")
end end
end end

View file

@ -69,7 +69,7 @@ class TestSystem < Test::Unit::TestCase
end end
end end
def test_empty_evstr # [ruby-dev:25113] def test_empty_evstr
assert_equal("", eval('"#{}"', nil, __FILE__, __LINE__)) assert_equal("", eval('"#{}"', nil, __FILE__, __LINE__), "[ruby-dev:25113]")
end end
end end

View file

@ -63,11 +63,11 @@ class TestTime < Test::Unit::TestCase
end end
end end
def test_huge_difference # [ruby-dev:22619] def test_huge_difference
if negative_time_t? if negative_time_t?
assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) - 0xffffffff) assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) - 0xffffffff, "[ruby-dev:22619]")
assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) + (-0xffffffff)) assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) + (-0xffffffff))
assert_equal(Time.at(0x7fffffff), Time.at(-0x80000000) + 0xffffffff) assert_equal(Time.at(0x7fffffff), Time.at(-0x80000000) + 0xffffffff, "[ruby-dev:22619]")
assert_equal(Time.at(0x7fffffff), Time.at(-0x80000000) - (-0xffffffff)) assert_equal(Time.at(0x7fffffff), Time.at(-0x80000000) - (-0xffffffff))
end end
end end

View file

@ -29,7 +29,7 @@ class TestBasicSocket < Test::Unit::TestCase
end end
end end
def test_setsockopt # [ruby-dev:25039] def test_setsockopt
s = nil s = nil
linger = [0, 0].pack("ii") linger = [0, 0].pack("ii")
@ -42,7 +42,7 @@ class TestBasicSocket < Test::Unit::TestCase
s = sock s = sock
assert_equal(0, s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger)) assert_equal(0, s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger))
assert_raise(IOError) { assert_raise(IOError, "[ruby-dev:25039]") {
s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, val) s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, val)
} }
end end

View file

@ -6,7 +6,7 @@ end
class TestTCPSocket < Test::Unit::TestCase class TestTCPSocket < Test::Unit::TestCase
def test_recvfrom # [ruby-dev:24705] def test_recvfrom
assert false, "TODO: doesn't work on mswin32/64" if /mswin/ =~ RUBY_PLATFORM assert false, "TODO: doesn't work on mswin32/64" if /mswin/ =~ RUBY_PLATFORM
c = s = nil c = s = nil
svr = TCPServer.new("localhost", 0) svr = TCPServer.new("localhost", 0)
@ -20,7 +20,7 @@ assert false, "TODO: doesn't work on mswin32/64" if /mswin/ =~ RUBY_PLATFORM
} }
addr = svr.addr addr = svr.addr
sock = TCPSocket.open(addr[2], addr[1]) sock = TCPSocket.open(addr[2], addr[1])
assert_raise(RuntimeError, SocketError) { assert_raise(RuntimeError, SocketError, "[ruby-dev:24705]") {
sock.recvfrom(0x10000) sock.recvfrom(0x10000)
} }
ensure ensure

View file

@ -6,26 +6,26 @@ end
class TestUDPSocket < Test::Unit::TestCase class TestUDPSocket < Test::Unit::TestCase
def test_connect # [ruby-dev:25045] def test_connect
s = UDPSocket.new s = UDPSocket.new
host = Object.new host = Object.new
class << host; self end.send(:define_method, :to_str) { class << host; self end.send(:define_method, :to_str) {
s.close s.close
"127.0.0.1" "127.0.0.1"
} }
assert_raise(IOError) { assert_raise(IOError, "[ruby-dev:25045]") {
s.connect(host, 1) s.connect(host, 1)
} }
end end
def test_bind # [ruby-dev:25057] def test_bind
s = UDPSocket.new s = UDPSocket.new
host = Object.new host = Object.new
class << host; self end.send(:define_method, :to_str) { class << host; self end.send(:define_method, :to_str) {
s.close s.close
"127.0.0.1" "127.0.0.1"
} }
assert_raise(IOError) { assert_raise(IOError, "[ruby-dev:25057]") {
s.bind(host, 2000) s.bind(host, 2000)
} }
end end

View file

@ -15,29 +15,29 @@ class TestStringIO < Test::Unit::TestCase
include TestEOF::Seek include TestEOF::Seek
def test_truncate # [ruby-dev:24190] def test_truncate
io = StringIO.new("") io = StringIO.new("")
io.puts "abc" io.puts "abc"
io.truncate(0) io.truncate(0)
io.puts "def" io.puts "def"
assert_equal("\0\0\0\0def\n", io.string) assert_equal("\0\0\0\0def\n", io.string, "[ruby-dev:24190]")
end end
def test_seek_beyond_eof # [ruby-dev:24194] def test_seek_beyond_eof
io = StringIO.new io = StringIO.new
n = 100 n = 100
io.seek(n) io.seek(n)
io.print "last" io.print "last"
assert_equal("\0" * n + "last", io.string) assert_equal("\0" * n + "last", io.string, "[ruby-dev:24194]")
end end
def test_overwrite # [ruby-core:03836] def test_overwrite
stringio = StringIO.new stringio = StringIO.new
responses = ['', 'just another ruby', 'hacker'] responses = ['', 'just another ruby', 'hacker']
responses.each do |resp| responses.each do |resp|
stringio.puts(resp) stringio.puts(resp)
stringio.rewind stringio.rewind
end end
assert_equal("hacker\nother ruby\n", stringio.string) assert_equal("hacker\nother ruby\n", stringio.string, "[ruby-core:3836]")
end end
end end

View file

@ -12,7 +12,6 @@ class TestCommon < Test::Unit::TestCase
end end
def test_extract def test_extract
# ruby-list:36086
assert_equal(['http://example.com'], assert_equal(['http://example.com'],
URI.extract('http://example.com')) URI.extract('http://example.com'))
assert_equal(['http://example.com'], assert_equal(['http://example.com'],
@ -20,9 +19,9 @@ class TestCommon < Test::Unit::TestCase
assert_equal(['http://example.com/foo)'], assert_equal(['http://example.com/foo)'],
URI.extract('(http://example.com/foo)')) URI.extract('(http://example.com/foo)'))
assert_equal(['http://example.jphttp://example.jp'], assert_equal(['http://example.jphttp://example.jp'],
URI.extract('http://example.jphttp://example.jp')) URI.extract('http://example.jphttp://example.jp'), "[ruby-list:36086]")
assert_equal(['http://example.jphttp://example.jp'], assert_equal(['http://example.jphttp://example.jp'],
URI.extract('http://example.jphttp://example.jp', ['http'])) URI.extract('http://example.jphttp://example.jp', ['http']), "[ruby-list:36086]")
assert_equal(['http://', 'mailto:'].sort, assert_equal(['http://', 'mailto:'].sort,
URI.extract('ftp:// http:// mailto: https://', ['http', 'mailto']).sort) URI.extract('ftp:// http:// mailto: https://', ['http', 'mailto']).sort)
# reported by Doug Kearns <djkea2@mugca.its.monash.edu.au> # reported by Doug Kearns <djkea2@mugca.its.monash.edu.au>

View file

@ -121,11 +121,10 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::Generic, url) assert_kind_of(URI::Generic, url)
# 9 # 9
# [ruby-dev:25667]
url = URI.parse('ftp://:pass@localhost/') url = URI.parse('ftp://:pass@localhost/')
assert_equal('', url.user) assert_equal('', url.user, "[ruby-dev:25667]")
assert_equal('pass', url.password) assert_equal('pass', url.password)
assert_equal(':pass', url.userinfo) assert_equal(':pass', url.userinfo, "[ruby-dev:25667]")
url = URI.parse('ftp://user@localhost/') url = URI.parse('ftp://user@localhost/')
assert_equal('user', url.user) assert_equal('user', url.user)
assert_equal(nil, url.password) assert_equal(nil, url.password)
@ -152,9 +151,8 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_equal(URI.parse('http://foo/baz'), u3 + '/baz') assert_equal(URI.parse('http://foo/baz'), u3 + '/baz')
assert_equal(URI.parse('http://foo/baz'), u4 + '/baz') assert_equal(URI.parse('http://foo/baz'), u4 + '/baz')
# from [ruby-dev:11508] Re: uri
url = URI.parse('http://hoge/a.html') + 'b.html' url = URI.parse('http://hoge/a.html') + 'b.html'
assert_equal('http://hoge/b.html', url.to_s) assert_equal('http://hoge/b.html', url.to_s, "[ruby-dev:11508]")
# reported by Mr. Kubota <em6t-kbt@asahi-net.or.jp> # reported by Mr. Kubota <em6t-kbt@asahi-net.or.jp>
url = URI.parse('http://a/b') + 'http://x/y' url = URI.parse('http://a/b') + 'http://x/y'
@ -171,15 +169,13 @@ class URI::TestGeneric < Test::Unit::TestCase
assert(nil != u.merge!("../baz")) assert(nil != u.merge!("../baz"))
assert_equal('http://foo/baz', u.to_s) assert_equal('http://foo/baz', u.to_s)
# [ruby-dev:23628]
u0 = URI.parse('mailto:foo@example.com') u0 = URI.parse('mailto:foo@example.com')
u1 = URI.parse('mailto:foo@example.com#bar') u1 = URI.parse('mailto:foo@example.com#bar')
assert_equal(uri_to_ary(u0 + '#bar'), uri_to_ary(u1)) assert_equal(uri_to_ary(u0 + '#bar'), uri_to_ary(u1), "[ruby-dev:23628]")
# [ruby-list:39838]
u0 = URI.parse('http://www.example.com/') u0 = URI.parse('http://www.example.com/')
u1 = URI.parse('http://www.example.com/foo/..') + './' u1 = URI.parse('http://www.example.com/foo/..') + './'
assert_equal(u0, u1) assert_equal(u0, u1, "[ruby-list:39838]")
u0 = URI.parse('http://www.example.com/foo/') u0 = URI.parse('http://www.example.com/foo/')
u1 = URI.parse('http://www.example.com/foo/bar/..') + './' u1 = URI.parse('http://www.example.com/foo/bar/..') + './'
assert_equal(u0, u1) assert_equal(u0, u1)
@ -193,11 +189,10 @@ class URI::TestGeneric < Test::Unit::TestCase
u1 = URI.parse('http://www.example.com/foo/bar/baz/../..') + './' u1 = URI.parse('http://www.example.com/foo/bar/baz/../..') + './'
assert_equal(u0, u1) assert_equal(u0, u1)
# [ruby-list:39844]
u = URI.parse('http://www.example.com/') u = URI.parse('http://www.example.com/')
u0 = u + './foo/' u0 = u + './foo/'
u1 = u + './foo/bar/..' u1 = u + './foo/bar/..'
assert_equal(u0, u1) assert_equal(u0, u1, "[ruby-list:39844]")
u = URI.parse('http://www.example.com/') u = URI.parse('http://www.example.com/')
u0 = u + './' u0 = u + './'
u1 = u + './foo/bar/../..' u1 = u + './foo/bar/../..'
@ -649,10 +644,9 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_equal(URI.parse('http://foo/hoge'), URI.join('http://foo', 'bar/baz', '/hoge')) assert_equal(URI.parse('http://foo/hoge'), URI.join('http://foo', 'bar/baz', '/hoge'))
end end
# ruby-dev:16728
def test_set_component def test_set_component
uri = URI.parse('http://foo:bar@baz') uri = URI.parse('http://foo:bar@baz')
assert_equal('oof', uri.user = 'oof') assert_equal('oof', uri.user = 'oof', "[ruby-dev:16728]")
assert_equal('http://oof:bar@baz', uri.to_s) assert_equal('http://oof:bar@baz', uri.to_s)
assert_equal('rab', uri.password = 'rab') assert_equal('rab', uri.password = 'rab')
assert_equal('http://oof:rab@baz', uri.to_s) assert_equal('http://oof:rab@baz', uri.to_s)

View file

@ -14,7 +14,7 @@ if defined? Zlib
assert_equal("", Zlib::GzipReader.new(StringIO.new(D0)).read(0)) assert_equal("", Zlib::GzipReader.new(StringIO.new(D0)).read(0))
end end
def test_ungetc # [ruby-dev:24060] def test_ungetc
s = "" s = ""
w = Zlib::GzipWriter.new(StringIO.new(s)) w = Zlib::GzipWriter.new(StringIO.new(s))
w << (1...1000).to_a.inspect w << (1...1000).to_a.inspect
@ -22,14 +22,14 @@ if defined? Zlib
r = Zlib::GzipReader.new(StringIO.new(s)) r = Zlib::GzipReader.new(StringIO.new(s))
r.read(100) r.read(100)
r.ungetc ?a r.ungetc ?a
assert_nothing_raised { assert_nothing_raised("[ruby-dev:24060]") {
r.read(100) r.read(100)
r.read r.read
r.close r.close
} }
end end
def test_ungetc_paragraph # [ruby-dev:24065] def test_ungetc_paragraph
s = "" s = ""
w = Zlib::GzipWriter.new(StringIO.new(s)) w = Zlib::GzipWriter.new(StringIO.new(s))
w << "abc" w << "abc"
@ -37,7 +37,7 @@ if defined? Zlib
r = Zlib::GzipReader.new(StringIO.new(s)) r = Zlib::GzipReader.new(StringIO.new(s))
r.ungetc ?\n r.ungetc ?\n
assert_equal("abc", r.gets("")) assert_equal("abc", r.gets(""))
assert_nothing_raised { assert_nothing_raised("[ruby-dev:24065]") {
r.read r.read
r.close r.close
} }
@ -46,12 +46,10 @@ if defined? Zlib
class TestZlibGzipWriter < Test::Unit::TestCase class TestZlibGzipWriter < Test::Unit::TestCase
def test_invalid_new def test_invalid_new
# [ruby-dev:23228] assert_raise(NoMethodError, "[ruby-dev:23228]") { Zlib::GzipWriter.new(nil).close }
assert_raise(NoMethodError) { Zlib::GzipWriter.new(nil).close } assert_raise(NoMethodError, "[ruby-dev:23344]") { Zlib::GzipWriter.new(true).close }
# [ruby-dev:23344] assert_raise(NoMethodError, "[ruby-dev:23344]") { Zlib::GzipWriter.new(0).close }
assert_raise(NoMethodError) { Zlib::GzipWriter.new(true).close } assert_raise(NoMethodError, "[ruby-dev:23344]") { Zlib::GzipWriter.new(:hoge).close }
assert_raise(NoMethodError) { Zlib::GzipWriter.new(0).close }
assert_raise(NoMethodError) { Zlib::GzipWriter.new(:hoge).close }
end end
end end
end end