* test/ruby/test_*.rb: assert_same, assert_match, and so on.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nahi 2003-09-06 17:27:58 +00:00
parent d7c5b0518a
commit a7357c1965
10 changed files with 29 additions and 29 deletions

View File

@ -1,3 +1,7 @@
Fri Sep 6 02:26:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/test_*.rb: assert_same, assert_match, and so on.
Sat Sep 6 18:45:46 2003 Mauricio Fernandez <batsman.geo@yahoo.com>
* parse.y (assignable): call rb_compile_error(), not rb_bug().

View File

@ -72,17 +72,17 @@ class TestBignum < Test::Unit::TestCase
assert_equal(0, -a % b)
end
def shift_test(a)
b = a / (2 ** 32)
c = a >> 32
assert_equal(b, c)
b = a * (2 ** 32)
c = a << 32
assert_equal(b, c)
end
def test_shift
def shift_test(a)
b = a / (2 ** 32)
c = a >> 32
assert_equal(b, c)
b = a * (2 ** 32)
c = a << 32
assert_equal(b, c)
end
shift_test(-4518325415524767873)
shift_test(-0xfffffffffffffffff)
end

View File

@ -45,11 +45,11 @@ class TestHash < Test::Unit::TestCase
$x = Hash.new([])
assert_equal([], $x[22])
assert($x[22].equal?($x[22]))
assert_same($x[22], $x[22])
$x = Hash.new{[]}
assert_equal([], $x[22])
assert(!$x[22].equal?($x[22]))
assert_not_same($x[22], $x[22])
$x = Hash.new{|h,k| $z = k; h[k] = k*2}
$z = 0

View File

@ -252,7 +252,7 @@ class TestIterator < Test::Unit::TestCase
assert_nothing_raised {Proc.new{|a,|}.call(1,2)}
end
def return1_test # !! test_return1 -> return1_test
def return1_test
Proc.new {
return 55
}.call + 5
@ -262,7 +262,7 @@ class TestIterator < Test::Unit::TestCase
assert_equal(55, return1_test())
end
def return2_test # !! test_return2 -> return2_test
def return2_test
lambda {
return 55
}.call + 5

View File

@ -13,7 +13,7 @@ class TestPack < Test::Unit::TestCase
assert_equal(ary.length, ary2.length)
assert_equal(ary.join(':'), ary2.join(':'))
assert($x =~ /def/)
assert_match(/def/, $x)
$x = [-1073741825]
assert_equal($x, $x.pack("q").unpack("q"))

View File

@ -5,7 +5,7 @@ $KCODE = 'none'
class TestStringchar < Test::Unit::TestCase
def test_string
assert_equal("abcd", "abcd")
assert("abcd" =~ /abcd/)
assert_match(/abcd/, "abcd")
assert("abcd" === "abcd")
# compile time string concatenation
assert_equal("abcd", "ab" "cd")

View File

@ -57,7 +57,6 @@ class TestSystem < Test::Unit::TestCase
File.unlink "script_tmp" or `/bin/rm -f "script_tmp"`
File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
$bad = false
if (dir = File.dirname(File.dirname($0))) == '.'
dir = ""
else

View File

@ -9,15 +9,15 @@ class TestTrace < Test::Unit::TestCase
trace_var :$x, proc{$y = $x}
$x = 40414
assert_equal($x, $y)
untrace_var :$x
$x = 19660208
assert($y != $x)
assert_not_equal($x, $y)
trace_var :$x, proc{$x *= 2}
$x = 5
assert_equal(10, $x)
untrace_var :$x
end
end

View File

@ -32,14 +32,11 @@ class TestVariable < Test::Unit::TestCase
end
def test_variable
assert($$.instance_of?(Fixnum))
assert_instance_of(Fixnum, $$)
# read-only variable
begin
assert_raises(NameError) do
$$ = 5
assert false
rescue NameError
assert true
end
foobar = "foobar"

View File

@ -13,8 +13,8 @@ class TestWhileuntil < Test::Unit::TestCase
tmp.close
tmp = open("while_tmp", "r")
assert_kind_of(File, tmp)
assert_instance_of(File, tmp)
while line = tmp.gets()
break if /vt100/ =~ line
end