Skip to content

Commit f2a8dc7

Browse files
committed
Specify the exit_status for ruby_exe when it is not 0
* Required by recent MSpec changes.
1 parent d44da2e commit f2a8dc7

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

spec/truffle/java_exception_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
describe "Internal errors reaching the top level" do
1212
it "show both the Java stacktrace and Ruby backtrace" do
1313
file = fixture(__FILE__, 'throw_java_exception.rb')
14-
out = ruby_exe(file, args: "2>&1")
14+
out = ruby_exe(file, args: "2>&1", exit_status: 1)
1515
out = out.gsub(/\.java:\d+/, '.java:LINE')
1616
out.should.include? <<-EOS
1717
truffleruby: an internal exception escaped out of the interpreter,
@@ -29,7 +29,7 @@
2929
end
3030

3131
it "show the cause" do
32-
out = ruby_exe("Truffle::Debug.throw_java_exception_with_cause 'message'", args: "2>&1")
32+
out = ruby_exe("Truffle::Debug.throw_java_exception_with_cause 'message'", args: "2>&1", exit_status: 1)
3333
message = out.gsub(/:\d+/, ':LINE')
3434

3535
message.should.include? <<-EOS
@@ -47,7 +47,7 @@
4747
end
4848
sleep
4949
RUBY
50-
out = ruby_exe(code, args: "2>&1")
50+
out = ruby_exe(code, args: "2>&1", exit_status: 1)
5151
$?.exitstatus.should == 1
5252
out.should.include? "```\nRuby Thread"
5353
out.should.include? "terminated with internal error: (java.lang.RuntimeException)"

spec/truffle/launcher_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ def should_print_full_java_command(options, env: {})
274274
end
275275

276276
it "prints an error for an unknown option" do
277-
out = ruby_exe(nil, options: "--unknown=value", args: "2>&1")
277+
out = ruby_exe(nil, options: "--unknown=value", args: "2>&1", exit_status: 2)
278278
$?.success?.should == false
279279
out.should include("invalid option --unknown=value")
280280

281-
out = ruby_exe(nil, options: "--ruby.unknown=value", args: "2>&1")
281+
out = ruby_exe(nil, options: "--ruby.unknown=value", args: "2>&1", exit_status: 2)
282282
$?.success?.should == false
283283
out.should include("invalid option --ruby.unknown=value")
284284
end
@@ -380,7 +380,7 @@ def should_print_full_java_command(options, env: {})
380380
end
381381

382382
it "does not print a Java backtrace for an -S file that's not found" do
383-
out = ruby_exe(nil, options: "-S does_not_exist", args: "2>&1")
383+
out = ruby_exe(nil, options: "-S does_not_exist", args: "2>&1", exit_status: 1)
384384
$?.success?.should == false
385385
out.should include('truffleruby: No such file or directory -- does_not_exist (LoadError)')
386386
out.should_not include('boot.rb')

spec/truffle/options/cexts_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
end
1919

2020
it "when disabled cannot use parts of the stdlib that use C extensions" do
21-
ruby_exe("require 'yaml'; p YAML.load('--- foo')", options: "--experimental-options --cexts=false", args: "2>&1").should =~ /disabled/
21+
ruby_exe("require 'yaml'; p YAML.load('--- foo')", options: "--experimental-options --cexts=false", args: "2>&1", exit_status: 1).should.include?("cannot load as C extensions are disabled")
2222
end
2323
end

spec/truffle/options/parsing_spec.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
require_relative '../../ruby/spec_helper'
1010

1111
describe "Options" do
12-
1312
describe "can correctly parse" do
14-
1513
it "booleans" do
1614
ruby_exe("p Truffle::Boot.get_option('frozen-string-literals')").should_not == "true\n"
1715
ruby_exe("p Truffle::Boot.get_option('frozen-string-literals')", options: "--experimental-options --frozen-string-literals=true").should == "true\n"
@@ -39,23 +37,19 @@
3937
ruby_exe("p Truffle::Boot.get_option('load-paths')", options: "--load-paths=a,b,c").should == "[\"a\", \"b\", \"c\"]\n"
4038
ruby_exe("p Truffle::Boot.get_option('load-paths')", options: "--load-paths=a\\\\,b,c").should == "[\"a,b\", \"c\"]\n"
4139
end
42-
4340
end
4441

4542
describe "handles parsing errors with" do
46-
4743
it "booleans" do
48-
ruby_exe("14", options: "--frozen-string-literals=foo", args: "2>&1").should include("Invalid boolean option value 'foo'")
44+
ruby_exe("14", options: "--frozen-string-literals=foo", args: "2>&1", exit_status: 1).should include("Invalid boolean option value 'foo'")
4945
end
5046

5147
it "integers" do
52-
ruby_exe("14", options: "--default-cache=foo", args: "2>&1").should include("Invalid argument --default-cache=foo specified")
48+
ruby_exe("14", options: "--default-cache=foo", args: "2>&1", exit_status: 1).should include("Invalid argument --default-cache=foo specified")
5349
end
5450

5551
it "enum values" do
56-
ruby_exe("14", options: "--verbose=foo", args: "2>&1").should include("Invalid argument --verbose=foo specified. No enum constant org.truffleruby.shared.options.Verbosity.FOO'")
52+
ruby_exe("14", options: "--verbose=foo", args: "2>&1", exit_status: 1).should include("Invalid argument --verbose=foo specified. No enum constant org.truffleruby.shared.options.Verbosity.FOO'")
5753
end
58-
5954
end
60-
6155
end

0 commit comments

Comments
 (0)