diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-12-23 12:28:32 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-23 13:05:25 +0900 |
commit | 5bb43aeb890657ea586e3fabbf763e5b5670ffd7 (patch) | |
tree | 830ce6c0ad107225d23c666087e6888a503346dd /spec/syntax_suggest | |
parent | 4d05a96d14221ab2855c2d0795d1a70216c70b75 (diff) | |
download | ruby-5bb43aeb890657ea586e3fabbf763e5b5670ffd7.tar.gz |
[ruby/syntax_suggest] Should not hardcode ruby name
https://github.com/ruby/syntax_suggest/commit/0d5201b24d
Diffstat (limited to 'spec/syntax_suggest')
-rw-r--r-- | spec/syntax_suggest/integration/ruby_command_line_spec.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/syntax_suggest/integration/ruby_command_line_spec.rb b/spec/syntax_suggest/integration/ruby_command_line_spec.rb index 5c7ee06d83..1f14d4c9dc 100644 --- a/spec/syntax_suggest/integration/ruby_command_line_spec.rb +++ b/spec/syntax_suggest/integration/ruby_command_line_spec.rb @@ -3,6 +3,7 @@ require_relative "../spec_helper" module SyntaxSuggest + ruby = ENV.fetch("RUBY", "ruby") RSpec.describe "Requires with ruby cli" do it "namespaces all monkeypatched methods" do Dir.mktmpdir do |dir| @@ -16,9 +17,9 @@ module SyntaxSuggest api_only_methods_file = tmpdir.join("api_only_methods.txt") kernel_methods_file = tmpdir.join("kernel_methods.txt") - d_pid = Process.spawn("ruby -I#{lib_dir} -rsyntax_suggest #{script} 2>&1 > #{syntax_suggest_methods_file}") - k_pid = Process.spawn("ruby #{script} 2>&1 >> #{kernel_methods_file}") - r_pid = Process.spawn("ruby -I#{lib_dir} -rsyntax_suggest/api #{script} 2>&1 > #{api_only_methods_file}") + d_pid = Process.spawn("#{ruby} -I#{lib_dir} -rsyntax_suggest #{script} 2>&1 > #{syntax_suggest_methods_file}") + k_pid = Process.spawn("#{ruby} #{script} 2>&1 >> #{kernel_methods_file}") + r_pid = Process.spawn("#{ruby} -I#{lib_dir} -rsyntax_suggest/api #{script} 2>&1 > #{api_only_methods_file}") Process.wait(k_pid) Process.wait(d_pid) @@ -69,7 +70,7 @@ module SyntaxSuggest load "#{script.expand_path}" EOM - out = `ruby -I#{lib_dir} -rsyntax_suggest #{require_rb} 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest #{require_rb} 2>&1` expect($?.success?).to be_falsey expect(out).to include('> 5 it "flerg"').once @@ -80,7 +81,7 @@ module SyntaxSuggest skip if ruby_core? skip if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.2") - out = `ruby -I#{lib_dir} -rsyntax_suggest -e "puts SyntaxError.instance_method(:detailed_message).source_location" 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest -e "puts SyntaxError.instance_method(:detailed_message).source_location" 2>&1` expect($?.success?).to be_truthy expect(out).to include(lib_dir.join("syntax_suggest").join("core_ext.rb").to_s).once @@ -106,7 +107,7 @@ module SyntaxSuggest end EOM - out = `ruby -I#{lib_dir} -rsyntax_suggest #{script} 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest #{script} 2>&1` expect($?.success?).to be_falsey expect(out).to include('> 5 it "flerg"').once @@ -133,7 +134,7 @@ module SyntaxSuggest load "#{script.expand_path}" EOM - out = `ruby -I#{lib_dir} -rsyntax_suggest #{require_rb} 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest #{require_rb} 2>&1` expect($?.success?).to be_truthy expect(out).to include("SyntaxSuggest is NOT loaded").once @@ -149,7 +150,7 @@ module SyntaxSuggest eval("def lol") EOM - out = `ruby -I#{lib_dir} -rsyntax_suggest #{script} 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest #{script} 2>&1` expect($?.success?).to be_falsey expect(out).to include("(eval):1") @@ -167,7 +168,7 @@ module SyntaxSuggest break EOM - out = `ruby -I#{lib_dir} -rsyntax_suggest -e "require_relative '#{script}'" 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest -e "require_relative '#{script}'" 2>&1` expect($?.success?).to be_falsey expect(out.downcase).to_not include("syntax ok") |