[前][次][番号順一覧][スレッド一覧]

ruby-changes:49908

From: k0kubun <ko1@a...>
Date: Wed, 24 Jan 2018 23:31:45 +0900 (JST)
Subject: [ruby-changes:49908] k0kubun:r62026 (trunk): system_spec.rb: add RubySpec for r62025

k0kubun	2018-01-24 23:31:40 +0900 (Wed, 24 Jan 2018)

  New Revision: 62026

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62026

  Log:
    system_spec.rb: add RubySpec for r62025
    
    NEWS: added an entry for `exception: true` option.

  Modified files:
    trunk/NEWS
    trunk/spec/ruby/core/kernel/system_spec.rb
Index: spec/ruby/core/kernel/system_spec.rb
===================================================================
--- spec/ruby/core/kernel/system_spec.rb	(revision 62025)
+++ spec/ruby/core/kernel/system_spec.rb	(revision 62026)
@@ -25,6 +25,14 @@ describe :kernel_system, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/system_spec.rb#L25
     $?.exitstatus.should == 1
   end
 
+  it "raises RuntimeError when `exception: true` is given and the command exits with a non-zero exit status" do
+    lambda { @object.system(ruby_cmd('exit 1'), exception: true) }.should raise_error(RuntimeError)
+  end
+
+  it "raises Errno::ENOENT when `exception: true` is given and the specified command does not exist" do
+    lambda { @object.system('feature_14386', exception: true) }.should raise_error(Errno::ENOENT)
+  end
+
   it "returns nil when command execution fails" do
     @object.system("sad").should be_nil
 
Index: NEWS
===================================================================
--- NEWS	(revision 62025)
+++ NEWS	(revision 62026)
@@ -26,6 +26,10 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L26
 
     * added Dir#each_child and Dir#children instance methods.  [Feature #13969]
 
+* Kernel
+
+  * Kernel.#system takes :exception option to raise an exception on failure. [Feature #14386]
+
 * Proc
 
   * Proc#call doesn't change $SAFE any more. [Feature #14250]

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]