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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

This commit is contained in:
nobu 2007-05-25 15:04:05 +00:00
parent d289b8e8c6
commit a1cb9efd34
3 changed files with 39 additions and 6 deletions

View file

@ -1,3 +1,6 @@
Sat May 26 00:05:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri May 25 16:04:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri May 25 16:04:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* yarvcore.c (Init_VM): wrap already initialized structs to use * yarvcore.c (Init_VM): wrap already initialized structs to use

View file

@ -1,5 +1,6 @@
require 'test/unit' require 'test/unit'
require 'tempfile' require 'tempfile'
$:.replace([File.dirname(File.expand_path(__FILE__))] | $:)
require 'envutil' require 'envutil'
class TestBeginEndBlock < Test::Unit::TestCase class TestBeginEndBlock < Test::Unit::TestCase
@ -12,9 +13,8 @@ class TestBeginEndBlock < Test::Unit::TestCase
def test_beginendblock def test_beginendblock
ruby = EnvUtil.rubybin ruby = EnvUtil.rubybin
target = File.join(DIR, 'beginmainend.rb') target = File.join(DIR, 'beginmainend.rb')
IO.popen("#{q(ruby)} #{q(target)}"){|io| result = IO.popen("#{q(ruby)} #{q(target)}"){|io|io.read}
assert_equal(%w(b1 b2-1 b2 main b3-1 b3 b4 e1 e4 e3 e2 e4-2 e4-1 e1-1 e4-1-1), io.read.split) assert_equal(%w(b1 b2-1 b2 main b3-1 b3 b4 e1 e4 e3 e2 e4-2 e4-1 e1-1 e4-1-1), result.split)
}
end end
def test_begininmethod def test_begininmethod
@ -54,4 +54,34 @@ EOW
# expecting Tempfile to unlink launcher and errout file. # expecting Tempfile to unlink launcher and errout file.
end end
def test_raise_in_at_exit
# [ruby-core:09675]
ruby = EnvUtil.rubybin
out = IO.popen("#{q(ruby)} -e 'STDERR.reopen(STDOUT);" \
"at_exit{raise %[SomethingBad]};" \
"raise %[SomethingElse]'") {|f|
f.read
}
assert_match /SomethingBad/, out
assert_match /SomethingElse/, out
end
def test_should_propagate_exit_code
ruby = EnvUtil.rubybin
assert_equal false, system("#{q(ruby)} -e 'at_exit{exit 2}'")
assert_equal 2, $?.exitstatus
assert_nil $?.termsig
end
def test_should_propagate_signaled
ruby = EnvUtil.rubybin
out = IO.popen("#{q(ruby)} -e 'STDERR.reopen(STDOUT);" \
"at_exit{Process.kill(:INT, $$)}'"){|f|
f.read
}
assert_match /Interrupt$/, out
Process.kill(0, 0) rescue return # check if signal works
assert_nil $?.exitstatus
assert_equal Signal.list["INT"], $?.termsig
end
end end

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-05-25" #define RUBY_RELEASE_DATE "2007-05-26"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070525 #define RUBY_RELEASE_CODE 20070526
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 5 #define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 25 #define RUBY_RELEASE_DAY 26
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];