diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-19 15:45:46 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-19 15:45:46 +0000 |
commit | 7e35911e105409fabe48dc2a6214479b6a6ffa24 (patch) | |
tree | 5b28440687c1701389b14598454e99aee9a925ba /sample/test.rb | |
parent | e08bc0a22ae6c2d2ac0664d82675ca81a30df607 (diff) |
* ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
before detach pid. [ruby-talk:71519]
* eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
[ruby-dev:20202]
* eval.c (BEGIN_CALLARGS): restore outer block by using
ruby_block->outer.
* eval.c (block_pass): do not alter block->prev, but block->outer.
* array.c (get_inspect_tbl): warning on wrong condition.
* eval.c (localjump_xvalue): renamed exitstatus to exit_value
since it's not exit "status" after all.
* eval.c (localjump_error): add reason to LocalJumpError.
* compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
is nil. now take new 2 arguments.
* time.c (time_cmp): 2003-05-16 fix was incomplete.
(ruby-bugs-ja:PR#458)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/test.rb')
-rw-r--r-- | sample/test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb index d49e7a3e28..c2263013d2 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -962,6 +962,28 @@ IterTest.new([[8]]).each8 {|x| test_ok(x == [8])} IterTest.new([[0,0]]).each0 {|x| test_ok(x == [0,0])} IterTest.new([[8,8]]).each8 {|x| test_ok(x == [8,8])} +def m + test_ok(block_given?) +end +m{p 'test'} + +def m + test_ok(block_given?,&proc) +end +m{p 'test'} + +class C + include Enumerable + def initialize + @a = [1,2,3] + end + def each(&block) + @a.each(&block) + end +end + +test_ok(C.new.collect{|n| n} == [1,2,3]) + test_check "float" test_ok(2.6.floor == 2) test_ok((-2.6).floor == -3) @@ -1526,6 +1548,11 @@ include Const2 STDERR.print "intentionally redefines TEST3, TEST4\n" if $VERBOSE test_ok([TEST1,TEST2,TEST3,TEST4] == [1,2,6,8]) + +test_ok((String <=> Object) == -1) +test_ok((Object <=> String) == 1) +test_ok((Array <=> String) == nil) + test_check "clone" foo = Object.new def foo.test |