summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_system.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index 60037ab044..0c0ad33fb6 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -160,4 +160,23 @@ class TestSystem < Test::Unit::TestCase
assert_equal(true, system(tmpfilename), '[ruby-core:32745]')
}
end if File.executable?("/bin/sh")
+
+ def test_system_exception
+ ruby = EnvUtil.rubybin
+ assert_nothing_raised do
+ system('feature_14235', exception: false)
+ system("'#{ruby}' -e 'exit 1'", exception: false)
+ end
+ assert_raise(Errno::ENOENT) do
+ system('feature_14235', exception: true)
+ end
+ assert_raise(RuntimeError) do
+ system("'#{ruby}' -e 'exit 1'", exception: true)
+ end
+ begin
+ system("'#{ruby}' -e 'exit 1'", exception: true)
+ rescue RuntimeError => e
+ assert_equal true, e.message.include?('status (1)')
+ end
+ end
end