From 22e2a6a999b958efe5d84d9c7314e450fda82254 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 2 Jun 2021 14:34:07 +0200 Subject: Update to ruby/spec@a0b7d0d --- spec/ruby/command_line/dash_encoding_spec.rb | 8 +++++- spec/ruby/command_line/dash_r_spec.rb | 2 +- spec/ruby/command_line/dash_upper_e_spec.rb | 3 ++- spec/ruby/command_line/dash_upper_s_spec.rb | 2 +- spec/ruby/command_line/dash_upper_u_spec.rb | 6 +++-- spec/ruby/command_line/dash_x_spec.rb | 2 +- spec/ruby/command_line/error_message_spec.rb | 4 +-- spec/ruby/command_line/rubyopt_spec.rb | 40 ++++++++++++++-------------- spec/ruby/command_line/syntax_error_spec.rb | 4 +-- 9 files changed, 40 insertions(+), 31 deletions(-) (limited to 'spec/ruby/command_line') diff --git a/spec/ruby/command_line/dash_encoding_spec.rb b/spec/ruby/command_line/dash_encoding_spec.rb index 36ce55af5f..5803d328c1 100644 --- a/spec/ruby/command_line/dash_encoding_spec.rb +++ b/spec/ruby/command_line/dash_encoding_spec.rb @@ -25,6 +25,12 @@ describe "The --encoding command line option" do end it "does not accept a third encoding" do - ruby_exe(@test_string, options: "--disable-gems --encoding big5:#{@enc2}:utf-32le", args: "2>&1").should =~ /extra argument for --encoding: utf-32le/ + options = { + options: "--disable-gems --encoding big5:#{@enc2}:utf-32le", + args: "2>&1", + exit_status: 1 + } + + ruby_exe(@test_string, options).should =~ /extra argument for --encoding: utf-32le/ end end diff --git a/spec/ruby/command_line/dash_r_spec.rb b/spec/ruby/command_line/dash_r_spec.rb index 46c000b9e7..ea5bde5adf 100644 --- a/spec/ruby/command_line/dash_r_spec.rb +++ b/spec/ruby/command_line/dash_r_spec.rb @@ -13,7 +13,7 @@ describe "The -r command line option" do end it "requires the file before parsing the main script" do - out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), options: "-r #{@test_file}", args: "2>&1") + out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), options: "-r #{@test_file}", args: "2>&1", exit_status: 1) $?.should_not.success? out.should include("REQUIRED") out.should include("syntax error") diff --git a/spec/ruby/command_line/dash_upper_e_spec.rb b/spec/ruby/command_line/dash_upper_e_spec.rb index b3c6ce262b..5a83962583 100644 --- a/spec/ruby/command_line/dash_upper_e_spec.rb +++ b/spec/ruby/command_line/dash_upper_e_spec.rb @@ -31,6 +31,7 @@ describe "ruby -E" do it "raises a RuntimeError if used with -U" do ruby_exe("p 1", options: '-Eascii:ascii -U', - args: '2>&1').should =~ /RuntimeError/ + args: '2>&1', + exit_status: 1).should =~ /RuntimeError/ end end diff --git a/spec/ruby/command_line/dash_upper_s_spec.rb b/spec/ruby/command_line/dash_upper_s_spec.rb index 3a28fa2ad2..17991503f1 100644 --- a/spec/ruby/command_line/dash_upper_s_spec.rb +++ b/spec/ruby/command_line/dash_upper_s_spec.rb @@ -21,7 +21,7 @@ describe 'The -S command line option' do end it "runs launcher found in PATH and sets the exit status to 1 if it fails" do - result = ruby_exe(nil, options: '-S dash_s_fail', env: { 'PATH' => @path }, args: '2>&1') + result = ruby_exe(nil, options: '-S dash_s_fail', env: { 'PATH' => @path }, args: '2>&1', exit_status: 1) result.should =~ /\bdie\b/ $?.exitstatus.should == 1 end diff --git a/spec/ruby/command_line/dash_upper_u_spec.rb b/spec/ruby/command_line/dash_upper_u_spec.rb index 2546b5b9f4..d62718b095 100644 --- a/spec/ruby/command_line/dash_upper_u_spec.rb +++ b/spec/ruby/command_line/dash_upper_u_spec.rb @@ -32,12 +32,14 @@ describe "ruby -U" do it "raises a RuntimeError if used with -Eext:int" do ruby_exe("p 1", options: '-U -Eascii:ascii', - args: '2>&1').should =~ /RuntimeError/ + args: '2>&1', + exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError if used with -E:int" do ruby_exe("p 1", options: '-U -E:ascii', - args: '2>&1').should =~ /RuntimeError/ + args: '2>&1', + exit_status: 1).should =~ /RuntimeError/ end end diff --git a/spec/ruby/command_line/dash_x_spec.rb b/spec/ruby/command_line/dash_x_spec.rb index eb89db0144..ae14b61070 100644 --- a/spec/ruby/command_line/dash_x_spec.rb +++ b/spec/ruby/command_line/dash_x_spec.rb @@ -9,7 +9,7 @@ describe "The -x command line option" do it "fails when /\#!.*ruby.*/-ish line in target file is not found" do bad_embedded_ruby = fixture __FILE__, "bin/bad_embedded_ruby.txt" - result = ruby_exe(bad_embedded_ruby, options: '-x', args: '2>&1') + result = ruby_exe(bad_embedded_ruby, options: '-x', args: '2>&1', exit_status: 1) result.should include "no Ruby script found in input" end diff --git a/spec/ruby/command_line/error_message_spec.rb b/spec/ruby/command_line/error_message_spec.rb index f3f7de4fd4..02150f30ce 100644 --- a/spec/ruby/command_line/error_message_spec.rb +++ b/spec/ruby/command_line/error_message_spec.rb @@ -2,10 +2,10 @@ require_relative '../spec_helper' describe "The error message caused by an exception" do it "is not printed to stdout" do - out = ruby_exe("this_does_not_exist", args: "2> #{File::NULL}") + out = ruby_exe("this_does_not_exist", args: "2> #{File::NULL}", exit_status: 1) out.chomp.should.empty? - out = ruby_exe("end #syntax error", args: "2> #{File::NULL}") + out = ruby_exe("end #syntax error", args: "2> #{File::NULL}", exit_status: 1) out.chomp.should.empty? end end diff --git a/spec/ruby/command_line/rubyopt_spec.rb b/spec/ruby/command_line/rubyopt_spec.rb index a739f23eb8..a2b817bad8 100644 --- a/spec/ruby/command_line/rubyopt_spec.rb +++ b/spec/ruby/command_line/rubyopt_spec.rb @@ -87,101 +87,101 @@ describe "Processing RUBYOPT" do it "raises a RuntimeError for '-a'" do ENV["RUBYOPT"] = '-a' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-p'" do ENV["RUBYOPT"] = '-p' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-n'" do ENV["RUBYOPT"] = '-n' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-y'" do ENV["RUBYOPT"] = '-y' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-c'" do ENV["RUBYOPT"] = '-c' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-s'" do ENV["RUBYOPT"] = '-s' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-h'" do ENV["RUBYOPT"] = '-h' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '--help'" do ENV["RUBYOPT"] = '--help' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-l'" do ENV["RUBYOPT"] = '-l' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-S'" do ENV["RUBYOPT"] = '-S irb' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-e'" do ENV["RUBYOPT"] = '-e0' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-i'" do ENV["RUBYOPT"] = '-i.bak' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-x'" do ENV["RUBYOPT"] = '-x' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-C'" do ENV["RUBYOPT"] = '-C' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-X'" do ENV["RUBYOPT"] = '-X.' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-F'" do ENV["RUBYOPT"] = '-F' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '-0'" do ENV["RUBYOPT"] = '-0' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '--copyright'" do ENV["RUBYOPT"] = '--copyright' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '--version'" do ENV["RUBYOPT"] = '--version' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end it "raises a RuntimeError for '--yydebug'" do ENV["RUBYOPT"] = '--yydebug' - ruby_exe("", args: '2>&1').should =~ /RuntimeError/ + ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/ end end diff --git a/spec/ruby/command_line/syntax_error_spec.rb b/spec/ruby/command_line/syntax_error_spec.rb index f61cfe928d..444ea9635c 100644 --- a/spec/ruby/command_line/syntax_error_spec.rb +++ b/spec/ruby/command_line/syntax_error_spec.rb @@ -2,12 +2,12 @@ require_relative '../spec_helper' describe "The interpreter" do it "prints an error when given a file with invalid syntax" do - out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), args: "2>&1") + out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), args: "2>&1", exit_status: 1) out.should include "syntax error" end it "prints an error when given code via -e with invalid syntax" do - out = ruby_exe(nil, args: "-e 'a{' 2>&1") + out = ruby_exe(nil, args: "-e 'a{' 2>&1", exit_status: 1) out.should include "syntax error" end end -- cgit v1.2.1