mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit.rb (assert_include): add alias.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
58b325366d
commit
7f46fadd9d
10 changed files with 20 additions and 15 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Feb 12 23:17:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/test/unit.rb (assert_include): add alias.
|
||||||
|
|
||||||
Sat Feb 12 14:44:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Feb 12 14:44:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* thread.c (rb_thread_io_blocking_region): new function to run
|
* thread.c (rb_thread_io_blocking_region): new function to run
|
||||||
|
|
|
@ -155,7 +155,8 @@ EOT
|
||||||
mname = ('assert_not_' << m.to_s[/.*?_(.*)/, 1])
|
mname = ('assert_not_' << m.to_s[/.*?_(.*)/, 1])
|
||||||
alias_method(mname, m) unless ms.include? mname
|
alias_method(mname, m) unless ms.include? mname
|
||||||
end
|
end
|
||||||
alias assert_no_match assert_not_match
|
alias assert_include assert_includes
|
||||||
|
alias assert_not_include assert_not_includes
|
||||||
|
|
||||||
def build_message(head, template=nil, *arguments)
|
def build_message(head, template=nil, *arguments)
|
||||||
template &&= template.chomp
|
template &&= template.chomp
|
||||||
|
|
|
@ -117,7 +117,7 @@ class TestIO_Console < Test::Unit::TestCase
|
||||||
s.print "a"
|
s.print "a"
|
||||||
s.oflush # oflush may be issued after "a" is already sent.
|
s.oflush # oflush may be issued after "a" is already sent.
|
||||||
s.print "b"
|
s.print "b"
|
||||||
assert_includes(["b", "ab"], m.readpartial(10))
|
assert_include(["b", "ab"], m.readpartial(10))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class TestIO_Console < Test::Unit::TestCase
|
||||||
s.print "a"
|
s.print "a"
|
||||||
s.ioflush # ioflush may be issued after "a" is already sent.
|
s.ioflush # ioflush may be issued after "a" is already sent.
|
||||||
s.print "b"
|
s.print "b"
|
||||||
assert_includes(["b", "ab"], m.readpartial(10))
|
assert_include(["b", "ab"], m.readpartial(10))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ class TestMkmf
|
||||||
assert_equal((prefix || signed)+type,
|
assert_equal((prefix || signed)+type,
|
||||||
mkmf {convertible_int("test1_t", "confdefs.h")}, MKMFLOG)
|
mkmf {convertible_int("test1_t", "confdefs.h")}, MKMFLOG)
|
||||||
(u = signed[/^u/]) and u.upcase!
|
(u = signed[/^u/]) and u.upcase!
|
||||||
assert_includes($defs, "-DTYPEOF_TEST1_T="+"#{prefix||signed}#{type}".quote)
|
assert_include($defs, "-DTYPEOF_TEST1_T="+"#{prefix||signed}#{type}".quote)
|
||||||
assert_includes($defs, "-DPRI_TEST1T_PREFIX=PRI_#{type.upcase}_PREFIX")
|
assert_include($defs, "-DPRI_TEST1T_PREFIX=PRI_#{type.upcase}_PREFIX")
|
||||||
assert_includes($defs, "-DTEST1T2NUM=#{u}#{type.upcase}2NUM")
|
assert_include($defs, "-DTEST1T2NUM=#{u}#{type.upcase}2NUM")
|
||||||
assert_includes($defs, "-DNUM2TEST1T=NUM2#{u}#{type.upcase}")
|
assert_include($defs, "-DNUM2TEST1T=NUM2#{u}#{type.upcase}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TestMkmf
|
||||||
}
|
}
|
||||||
$defs.clear
|
$defs.clear
|
||||||
assert_equal(expect.to_i, mkmf {check_signedness("test1_t", "confdefs.h")}, MKMFLOG)
|
assert_equal(expect.to_i, mkmf {check_signedness("test1_t", "confdefs.h")}, MKMFLOG)
|
||||||
assert_includes($defs, "-DSIGNEDNESS_OF_TEST1_T=#{expect}")
|
assert_include($defs, "-DSIGNEDNESS_OF_TEST1_T=#{expect}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -532,7 +532,7 @@ class TestPathname < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_mountpoint?
|
def test_mountpoint?
|
||||||
r = Pathname("/").mountpoint?
|
r = Pathname("/").mountpoint?
|
||||||
assert_includes([true, false], r)
|
assert_include([true, false], r)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destructive_update
|
def test_destructive_update
|
||||||
|
|
|
@ -3,14 +3,14 @@ require 'tmpdir'
|
||||||
|
|
||||||
class TestNotImplement < Test::Unit::TestCase
|
class TestNotImplement < Test::Unit::TestCase
|
||||||
def test_respond_to_fork
|
def test_respond_to_fork
|
||||||
assert_includes(Process.methods, :fork)
|
assert_include(Process.methods, :fork)
|
||||||
if /linux/ =~ RUBY_PLATFORM
|
if /linux/ =~ RUBY_PLATFORM
|
||||||
assert_equal(true, Process.respond_to?(:fork))
|
assert_equal(true, Process.respond_to?(:fork))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_respond_to_lchmod
|
def test_respond_to_lchmod
|
||||||
assert_includes(File.methods, :lchmod)
|
assert_include(File.methods, :lchmod)
|
||||||
if /linux/ =~ RUBY_PLATFORM
|
if /linux/ =~ RUBY_PLATFORM
|
||||||
assert_equal(false, File.respond_to?(:lchmod))
|
assert_equal(false, File.respond_to?(:lchmod))
|
||||||
end
|
end
|
||||||
|
|
|
@ -139,7 +139,7 @@ class TestPack < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_integer_endian
|
def test_integer_endian
|
||||||
s = [1].pack("s")
|
s = [1].pack("s")
|
||||||
assert_includes(["\0\1", "\1\0"], s)
|
assert_include(["\0\1", "\1\0"], s)
|
||||||
if s == "\0\1"
|
if s == "\0\1"
|
||||||
_integer_big_endian()
|
_integer_big_endian()
|
||||||
else
|
else
|
||||||
|
|
|
@ -357,7 +357,7 @@ END
|
||||||
end
|
end
|
||||||
v = r.rand(3.1..4)
|
v = r.rand(3.1..4)
|
||||||
assert_instance_of(Float, v, '[ruby-core:24679]')
|
assert_instance_of(Float, v, '[ruby-core:24679]')
|
||||||
assert_includes(3.1..4, v)
|
assert_include(3.1..4, v)
|
||||||
|
|
||||||
now = Time.now
|
now = Time.now
|
||||||
assert_equal(now, r.rand(now..now))
|
assert_equal(now, r.rand(now..now))
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase
|
||||||
assert_equal(Socket::AF_INET, ai.afamily)
|
assert_equal(Socket::AF_INET, ai.afamily)
|
||||||
assert_equal(Socket::PF_INET, ai.pfamily)
|
assert_equal(Socket::PF_INET, ai.pfamily)
|
||||||
assert_equal(Socket::SOCK_STREAM, ai.socktype)
|
assert_equal(Socket::SOCK_STREAM, ai.socktype)
|
||||||
assert_includes([0, Socket::IPPROTO_TCP], ai.protocol)
|
assert_include([0, Socket::IPPROTO_TCP], ai.protocol)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_addrinfo_udp
|
def test_addrinfo_udp
|
||||||
|
@ -44,7 +44,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase
|
||||||
assert_equal(Socket::AF_INET, ai.afamily)
|
assert_equal(Socket::AF_INET, ai.afamily)
|
||||||
assert_equal(Socket::PF_INET, ai.pfamily)
|
assert_equal(Socket::PF_INET, ai.pfamily)
|
||||||
assert_equal(Socket::SOCK_DGRAM, ai.socktype)
|
assert_equal(Socket::SOCK_DGRAM, ai.socktype)
|
||||||
assert_includes([0, Socket::IPPROTO_UDP], ai.protocol)
|
assert_include([0, Socket::IPPROTO_UDP], ai.protocol)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_addrinfo_ip_unpack
|
def test_addrinfo_ip_unpack
|
||||||
|
|
Loading…
Reference in a new issue