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

* 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