diff options
Diffstat (limited to 'spec/syntax_suggest/integration')
| -rw-r--r-- | spec/syntax_suggest/integration/ruby_command_line_spec.rb | 4 | ||||
| -rw-r--r-- | spec/syntax_suggest/integration/syntax_suggest_spec.rb | 33 |
2 files changed, 25 insertions, 12 deletions
diff --git a/spec/syntax_suggest/integration/ruby_command_line_spec.rb b/spec/syntax_suggest/integration/ruby_command_line_spec.rb index c1ec4be54e..02354ceff0 100644 --- a/spec/syntax_suggest/integration/ruby_command_line_spec.rb +++ b/spec/syntax_suggest/integration/ruby_command_line_spec.rb @@ -94,8 +94,6 @@ module SyntaxSuggest end it "gem can be tested when executing on Ruby with default gem included" do - 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` expect($?.success?).to be_truthy @@ -103,8 +101,6 @@ module SyntaxSuggest end it "annotates a syntax error in Ruby 3.2+ when require is not used" do - skip if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.2") - Dir.mktmpdir do |dir| tmpdir = Pathname(dir) script = tmpdir.join("script.rb") diff --git a/spec/syntax_suggest/integration/syntax_suggest_spec.rb b/spec/syntax_suggest/integration/syntax_suggest_spec.rb index 015d088c92..de9bc5d38e 100644 --- a/spec/syntax_suggest/integration/syntax_suggest_spec.rb +++ b/spec/syntax_suggest/integration/syntax_suggest_spec.rb @@ -4,10 +4,6 @@ require_relative "../spec_helper" module SyntaxSuggest RSpec.describe "Integration tests that don't spawn a process (like using the cli)" do - before(:each) do - skip "Benchmark is not available" unless defined?(::Benchmark) - end - it "does not timeout on massive files" do next unless ENV["SYNTAX_SUGGEST_TIMEOUT"] @@ -17,7 +13,7 @@ module SyntaxSuggest io = StringIO.new - benchmark = Benchmark.measure do + benchmark_measure do debug_perf do SyntaxSuggest.call( io: io, @@ -28,7 +24,6 @@ module SyntaxSuggest end debug_display(io.string) - debug_display(benchmark) expect(io.string).to include(<<~EOM) 6 class SyntaxTree < Ripper @@ -46,7 +41,7 @@ module SyntaxSuggest io = StringIO.new debug_perf do - benchmark = Benchmark.measure do + benchmark_measure do SyntaxSuggest.call( io: io, source: file.read, @@ -54,7 +49,6 @@ module SyntaxSuggest ) end debug_display(io.string) - debug_display(benchmark) end expect(io.string).to_not include("def ruby_install_binstub_path") @@ -209,6 +203,29 @@ module SyntaxSuggest EOM end + it "multi-line chain with missing paren" do + source = <<~EOM + class Dog + def bark + User + .where(name: "schneems" + .first + end + end + EOM + io = StringIO.new + SyntaxSuggest.call( + io: io, + source: source + ) + out = io.string + expect(out).to include(<<~EOM) + > 3 User + > 4 .where(name: "schneems" + > 5 .first + EOM + end + it "empty else" do source = <<~EOM class Foo |
