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> Sat Sep 6 18:45:46 2003 Mauricio Fernandez <batsman.geo@yahoo.com>
* parse.y (assignable): call rb_compile_error(), not rb_bug(). * parse.y (assignable): call rb_compile_error(), not rb_bug().

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@ $KCODE = 'none'
class TestStringchar < Test::Unit::TestCase class TestStringchar < Test::Unit::TestCase
def test_string def test_string
assert_equal("abcd", "abcd") assert_equal("abcd", "abcd")
assert("abcd" =~ /abcd/) assert_match(/abcd/, "abcd")
assert("abcd" === "abcd") assert("abcd" === "abcd")
# compile time string concatenation # compile time string concatenation
assert_equal("abcd", "ab" "cd") 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" or `/bin/rm -f "script_tmp"`
File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"` File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
$bad = false
if (dir = File.dirname(File.dirname($0))) == '.' if (dir = File.dirname(File.dirname($0))) == '.'
dir = "" dir = ""
else else

View file

@ -12,7 +12,7 @@ class TestTrace < Test::Unit::TestCase
untrace_var :$x untrace_var :$x
$x = 19660208 $x = 19660208
assert($y != $x) assert_not_equal($x, $y)
trace_var :$x, proc{$x *= 2} trace_var :$x, proc{$x *= 2}
$x = 5 $x = 5

View file

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

View file

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