From 503b004c590b8dbe6952654da31356c9a38c59b8 Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 17 Mar 2023 16:20:14 -0500 Subject: [PATCH 1/2] Move dependencies to gemspec --- Gemfile.lock | 72 ++++++++++++++++++++++-------------------- syntax_suggest.gemspec | 7 ++++ 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b5dd5dd..669a066 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,52 +7,56 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.2) - benchmark-ips (2.9.2) - diff-lcs (1.4.4) - parallel (1.21.0) - parser (3.0.2.0) + benchmark-ips (2.12.0) + diff-lcs (1.5.0) + json (2.6.3) + language_server-protocol (3.17.0.3) + parallel (1.22.1) + parser (3.2.1.1) ast (~> 2.4.1) - rainbow (3.0.0) + rainbow (3.1.1) rake (12.3.3) - regexp_parser (2.1.1) + regexp_parser (2.7.0) rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.0) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.1) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.4) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-support (3.10.0) - rubocop (1.20.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) + rubocop (1.48.1) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.9.1, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.26.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.12.0) - parser (>= 3.0.1.1) - rubocop-performance (1.11.5) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.27.0) + parser (>= 3.2.1.0) + rubocop-performance (1.16.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - ruby-prof (1.4.3) - ruby-progressbar (1.11.0) - stackprof (0.2.16) - standard (1.3.0) - rubocop (= 1.20.0) - rubocop-performance (= 1.11.5) - unicode-display_width (2.1.0) + ruby-prof (1.6.1) + ruby-progressbar (1.13.0) + stackprof (0.2.23) + standard (1.25.0) + language_server-protocol (~> 3.17.0.2) + rubocop (= 1.48.1) + rubocop-performance (= 1.16.0) + unicode-display_width (2.4.2) PLATFORMS - ruby + x86_64-darwin-20 DEPENDENCIES benchmark-ips @@ -64,4 +68,4 @@ DEPENDENCIES syntax_suggest! BUNDLED WITH - 2.3.14 + 2.4.8 diff --git a/syntax_suggest.gemspec b/syntax_suggest.gemspec index 73b25c6..c19f41b 100644 --- a/syntax_suggest.gemspec +++ b/syntax_suggest.gemspec @@ -29,4 +29,11 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + + spec.add_development_dependency "rake", "~> 13.0.6" + spec.add_development_dependency "rspec", "~> 3.12" + spec.add_development_dependency "stackprof", "~> 0.2.23" + spec.add_development_dependency "standard", "~> 1.25" + spec.add_development_dependency "ruby-prof", "~> 1.6.1" + spec.add_development_dependency "benchmark-ips", "~> 2.12.0" end From 31bab1400d821db26383b06991e8f11a0b0b057c Mon Sep 17 00:00:00 2001 From: schneems Date: Fri, 17 Mar 2023 16:38:47 -0500 Subject: [PATCH 2/2] Update local standardrb to latest version --- Gemfile | 8 -- lib/syntax_suggest/code_search.rb | 2 +- lib/syntax_suggest/display_invalid_blocks.rb | 2 +- spec/integration/ruby_command_line_spec.rb | 6 +- spec/integration/syntax_suggest_spec.rb | 14 ++-- spec/unit/around_block_scan_spec.rb | 2 +- spec/unit/capture_code_context_spec.rb | 24 +++--- spec/unit/clean_document_spec.rb | 6 +- spec/unit/code_line_spec.rb | 12 +-- spec/unit/code_search_spec.rb | 82 ++++++++++---------- spec/unit/core_ext_spec.rb | 2 +- 11 files changed, 76 insertions(+), 84 deletions(-) diff --git a/Gemfile b/Gemfile index 420c84b..4650275 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,3 @@ source "https://rubygems.org" # Specify your gem's dependencies in dead_end.gemspec gemspec - -gem "rake", "~> 12.0" -gem "rspec", "~> 3.0" -gem "stackprof" -gem "standard" -gem "ruby-prof" - -gem "benchmark-ips" diff --git a/lib/syntax_suggest/code_search.rb b/lib/syntax_suggest/code_search.rb index 2a86dfe..f9d3e2a 100644 --- a/lib/syntax_suggest/code_search.rb +++ b/lib/syntax_suggest/code_search.rb @@ -43,7 +43,7 @@ class CodeSearch def initialize(source, record_dir: DEFAULT_VALUE) record_dir = if record_dir == DEFAULT_VALUE - ENV["SYNTAX_SUGGEST_RECORD_DIR"] || ENV["SYNTAX_SUGGEST_DEBUG"] ? "tmp" : nil + (ENV["SYNTAX_SUGGEST_RECORD_DIR"] || ENV["SYNTAX_SUGGEST_DEBUG"]) ? "tmp" : nil else record_dir end diff --git a/lib/syntax_suggest/display_invalid_blocks.rb b/lib/syntax_suggest/display_invalid_blocks.rb index 32ec002..5e79b3a 100644 --- a/lib/syntax_suggest/display_invalid_blocks.rb +++ b/lib/syntax_suggest/display_invalid_blocks.rb @@ -14,7 +14,7 @@ def initialize(code_lines:, blocks:, io: $stderr, filename: nil, terminal: DEFAU @filename = filename @code_lines = code_lines - @terminal = terminal == DEFAULT_VALUE ? io.isatty : terminal + @terminal = (terminal == DEFAULT_VALUE) ? io.isatty : terminal end def document_ok? diff --git a/spec/integration/ruby_command_line_spec.rb b/spec/integration/ruby_command_line_spec.rb index e7523ee..6b53aae 100644 --- a/spec/integration/ruby_command_line_spec.rb +++ b/spec/integration/ruby_command_line_spec.rb @@ -9,7 +9,7 @@ module SyntaxSuggest Dir.mktmpdir do |dir| tmpdir = Pathname(dir) script = tmpdir.join("script.rb") - script.write <<~'EOM' + script.write <<~EOM puts Kernel.private_methods EOM @@ -159,7 +159,7 @@ class Dog Dir.mktmpdir do |dir| tmpdir = Pathname(dir) script = tmpdir.join("script.rb") - script.write <<~'EOM' + script.write <<~EOM $stderr = STDOUT eval("def lol") EOM @@ -178,7 +178,7 @@ class Dog Dir.mktmpdir do |dir| tmpdir = Pathname(dir) script = tmpdir.join("script.rb") - script.write <<~'EOM' + script.write <<~EOM break EOM diff --git a/spec/integration/syntax_suggest_spec.rb b/spec/integration/syntax_suggest_spec.rb index bb50faf..c219ce1 100644 --- a/spec/integration/syntax_suggest_spec.rb +++ b/spec/integration/syntax_suggest_spec.rb @@ -25,7 +25,7 @@ module SyntaxSuggest debug_display(benchmark) end - expect(io.string).to include(<<~'EOM') + expect(io.string).to include(<<~EOM) 6 class SyntaxTree < Ripper 170 def self.parse(source) 174 end @@ -53,7 +53,7 @@ module SyntaxSuggest end expect(io.string).to_not include("def ruby_install_binstub_path") - expect(io.string).to include(<<~'EOM') + expect(io.string).to include(<<~EOM) > 1067 def add_yarn_binary > 1068 return [] if yarn_preinstalled? > 1069 | @@ -71,7 +71,7 @@ module SyntaxSuggest ) debug_display(io.string) - expect(io.string).to include(<<~'EOM') + expect(io.string).to include(<<~EOM) 1 Rails.application.routes.draw do > 113 namespace :admin do > 116 match "/foobar(*path)", via: :all, to: redirect { |_params, req| @@ -90,7 +90,7 @@ module SyntaxSuggest ) debug_display(io.string) - expect(io.string).to include(<<~'EOM') + expect(io.string).to include(<<~EOM) 1 describe "webmock tests" do 22 it "body" do 27 query = Cutlass::FunctionQuery.new( @@ -112,7 +112,7 @@ module SyntaxSuggest ) debug_display(io.string) - expect(io.string).to include(<<~'EOM') + expect(io.string).to include(<<~EOM) 5 module DerailedBenchmarks 6 class RequireTree 7 REQUIRED_BY = {} @@ -169,7 +169,7 @@ module SyntaxSuggest end it "ambiguous end" do - source = <<~'EOM' + source = <<~EOM def call # 0 print "lol" # 1 end # one # 2 @@ -189,7 +189,7 @@ def call # 0 end it "simple regression" do - source = <<~'EOM' + source = <<~EOM class Dog def bark puts "woof" diff --git a/spec/unit/around_block_scan_spec.rb b/spec/unit/around_block_scan_spec.rb index 88d973e..8839596 100644 --- a/spec/unit/around_block_scan_spec.rb +++ b/spec/unit/around_block_scan_spec.rb @@ -5,7 +5,7 @@ module SyntaxSuggest RSpec.describe AroundBlockScan do it "continues scan from last location even if scan is false" do - source = <<~'EOM' + source = <<~EOM print 'omg' print 'lol' print 'haha' diff --git a/spec/unit/capture_code_context_spec.rb b/spec/unit/capture_code_context_spec.rb index e1bc281..d2f7da1 100644 --- a/spec/unit/capture_code_context_spec.rb +++ b/spec/unit/capture_code_context_spec.rb @@ -5,7 +5,7 @@ module SyntaxSuggest RSpec.describe CaptureCodeContext do it "capture_before_after_kws" do - source = <<~'EOM' + source = <<~EOM def sit end @@ -23,7 +23,7 @@ def eat code_lines: code_lines ) lines = display.call - expect(lines.join).to eq(<<~'EOM') + expect(lines.join).to eq(<<~EOM) def sit end def bark @@ -33,7 +33,7 @@ def eat end it "handles ambiguous end" do - source = <<~'EOM' + source = <<~EOM def call # 0 print "lol" # 1 end # one # 2 @@ -52,7 +52,7 @@ def call # 0 lines = lines.sort.map(&:original) - expect(lines.join).to eq(<<~'EOM') + expect(lines.join).to eq(<<~EOM) def call # 0 end # one # 2 end # two # 3 @@ -79,7 +79,7 @@ def call # 0 lines = display.call lines = lines.sort.map(&:original) - expect(lines.join).to include(<<~'EOM'.indent(2)) + expect(lines.join).to include(<<~EOM.indent(2)) class Lookups def format_requires end @@ -87,7 +87,7 @@ def format_requires end it "shows ends of captured block" do - source = <<~'EOM' + source = <<~EOM class Dog def bark puts "woof" @@ -105,7 +105,7 @@ def bark code_lines: code_lines ) lines = display.call.sort.map(&:original) - expect(lines.join).to eq(<<~'EOM') + expect(lines.join).to eq(<<~EOM) class Dog def bark end @@ -113,7 +113,7 @@ def bark end it "captures surrounding context on falling indent" do - source = <<~'EOM' + source = <<~EOM class Blerg end @@ -137,7 +137,7 @@ class Zerg code_lines: code_lines ) lines = display.call.sort.map(&:original) - expect(lines.join).to eq(<<~'EOM') + expect(lines.join).to eq(<<~EOM) class OH def hello it "foo" do @@ -147,7 +147,7 @@ def hello end it "captures surrounding context on same indent" do - source = <<~'EOM' + source = <<~EOM class Blerg end class OH @@ -173,7 +173,7 @@ class Zerg code_lines = CleanDocument.new(source: source).call.lines block = CodeBlock.new(lines: code_lines[7..10]) - expect(block.to_s).to eq(<<~'EOM'.indent(2)) + expect(block.to_s).to eq(<<~EOM.indent(2)) def lol end @@ -190,7 +190,7 @@ def lol lines: lines ).call - expect(out).to eq(<<~'EOM'.indent(2)) + expect(out).to eq(<<~EOM.indent(2)) 3 class OH 8 def lol 9 end diff --git a/spec/unit/clean_document_spec.rb b/spec/unit/clean_document_spec.rb index 25a62e4..b03e6cc 100644 --- a/spec/unit/clean_document_spec.rb +++ b/spec/unit/clean_document_spec.rb @@ -8,7 +8,7 @@ module SyntaxSuggest source = fixtures_dir.join("this_project_extra_def.rb.txt").read code_lines = CleanDocument.new(source: source).call.lines - expect(code_lines[18 - 1].to_s).to eq(<<-'EOL') + expect(code_lines[18 - 1].to_s).to eq(<<-EOL) @io.puts <<~EOM SyntaxSuggest: A syntax error was detected @@ -54,7 +54,7 @@ module SyntaxSuggest DisplayCodeWithLineNumbers.new( lines: lines ).call - ).to eq(<<~'EOM'.indent(2)) + ).to eq(<<~EOM.indent(2)) 1 User 2 .where(name: 'schneems') 3 .first @@ -65,7 +65,7 @@ module SyntaxSuggest lines: lines, highlight_lines: lines[0] ).call - ).to eq(<<~'EOM') + ).to eq(<<~EOM) > 1 User > 2 .where(name: 'schneems') > 3 .first diff --git a/spec/unit/code_line_spec.rb b/spec/unit/code_line_spec.rb index d5b568f..5b62cc2 100644 --- a/spec/unit/code_line_spec.rb +++ b/spec/unit/code_line_spec.rb @@ -5,7 +5,7 @@ module SyntaxSuggest RSpec.describe CodeLine do it "bug in keyword detection" do - lines = CodeLine.from_source(<<~'EOM') + lines = CodeLine.from_source(<<~EOM) def to_json(*opts) { type: :module, @@ -19,7 +19,7 @@ def to_json(*opts) it "supports endless method definitions" do skip("Unsupported ruby version") unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3") - line = CodeLine.from_source(<<~'EOM').first + line = CodeLine.from_source(<<~EOM).first def square(x) = x * x EOM @@ -28,7 +28,7 @@ def square(x) = x * x end it "retains original line value, after being marked invisible" do - line = CodeLine.from_source(<<~'EOM').first + line = CodeLine.from_source(<<~EOM).first puts "lol" EOM expect(line.line).to match('puts "lol"') @@ -38,7 +38,7 @@ def square(x) = x * x end it "knows which lines can be joined" do - code_lines = CodeLine.from_source(<<~'EOM') + code_lines = CodeLine.from_source(<<~EOM) user = User. where(name: 'schneems'). first @@ -50,7 +50,7 @@ def square(x) = x * x end it "trailing if" do - code_lines = CodeLine.from_source(<<~'EOM') + code_lines = CodeLine.from_source(<<~EOM) puts "lol" if foo if foo end @@ -60,7 +60,7 @@ def square(x) = x * x end it "trailing unless" do - code_lines = CodeLine.from_source(<<~'EOM') + code_lines = CodeLine.from_source(<<~EOM) puts "lol" unless foo unless foo end diff --git a/spec/unit/code_search_spec.rb b/spec/unit/code_search_spec.rb index f836ba3..502de14 100644 --- a/spec/unit/code_search_spec.rb +++ b/spec/unit/code_search_spec.rb @@ -12,13 +12,13 @@ module SyntaxSuggest search = CodeSearch.new(source) search.call - expect(search.invalid_blocks.join.strip).to eq(<<~'EOM'.strip) + expect(search.invalid_blocks.join.strip).to eq(<<~EOM.strip) class Lookups EOM end it "squished do regression" do - source = <<~'EOM' + source = <<~EOM def call trydo @@ -47,14 +47,14 @@ def call search = CodeSearch.new(source) search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) trydo end # one EOM end it "regression test ambiguous end" do - source = <<~'EOM' + source = <<~EOM def call # 0 print "lol" # 1 end # one # 2 @@ -64,13 +64,13 @@ def call # 0 search = CodeSearch.new(source) search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) end # two # 3 EOM end it "regression dog test" do - source = <<~'EOM' + source = <<~EOM class Dog def bark puts "woof" @@ -79,7 +79,7 @@ def bark search = CodeSearch.new(source) search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) class Dog EOM expect(search.invalid_blocks.first.lines.length).to eq(4) @@ -99,7 +99,7 @@ class Foo search = CodeSearch.new(source) search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) Foo.call do |a end # one EOM @@ -118,7 +118,7 @@ class Foo search = CodeSearch.new(source) search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) Foo.call do { EOM end @@ -152,7 +152,7 @@ class Foo end it "handles no spaces between blocks" do - source = <<~'EOM' + source = <<~EOM context "foo bar" do it "bars the foo" do travel_to DateTime.new(2020, 10, 1, 10, 0, 0) do @@ -172,7 +172,7 @@ class Foo it "records debugging steps to a directory" do Dir.mktmpdir do |dir| dir = Pathname(dir) - search = CodeSearch.new(<<~'EOM', record_dir: dir) + search = CodeSearch.new(<<~EOM, record_dir: dir) class OH def hello def hai @@ -193,7 +193,7 @@ def hai end it "def with missing end" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) class OH def hello @@ -206,7 +206,7 @@ def hai expect(search.invalid_blocks.join.strip).to eq("def hello") - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) class OH def hello @@ -218,7 +218,7 @@ def hai expect(search.invalid_blocks.join.strip).to eq("def hello") - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) class OH def hello def hai @@ -227,7 +227,7 @@ def hai EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) def hello EOM end @@ -244,13 +244,13 @@ def hello highlight_lines: search.invalid_blocks.flat_map(&:lines) ).call - expect(document).to include(<<~'EOM') + expect(document).to include(<<~EOM) > 36 def filename EOM end it "Format Code blocks real world example" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) require 'rails_helper' RSpec.describe AclassNameHere, type: :worker do @@ -291,7 +291,7 @@ def hello highlight_lines: search.invalid_blocks.flat_map(&:lines) ).call - expect(document).to include(<<~'EOM') + expect(document).to include(<<~EOM) 1 require 'rails_helper' 2 3 RSpec.describe AclassNameHere, type: :worker do @@ -308,7 +308,7 @@ def hello describe "needs improvement" do describe "mis-matched-indentation" do it "extra space before end" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) Foo.call def foo puts "lol" @@ -318,14 +318,14 @@ def foo EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) Foo.call end # two EOM end it "stacked ends 2" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) def cat blerg end @@ -339,7 +339,7 @@ def dog EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) Foo.call do end # one end # two @@ -348,7 +348,7 @@ def dog end it "stacked ends " do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) Foo.call def foo puts "lol" @@ -358,14 +358,14 @@ def foo EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) Foo.call end EOM end it "missing space before end" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) Foo.call def foo @@ -377,7 +377,7 @@ def foo search.call # expand-1 and expand-2 seem to be broken? - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) Foo.call end EOM @@ -386,7 +386,7 @@ def foo end it "returns syntax error in outer block without inner block" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) Foo.call def foo puts "lol" @@ -396,27 +396,27 @@ def foo EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) Foo.call end # two EOM end it "doesn't just return an empty `end`" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) Foo.call end EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) Foo.call end EOM end it "finds multiple syntax errors" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) describe "hi" do Foo.call end @@ -429,7 +429,7 @@ def foo EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) Foo.call end Bar.call @@ -438,47 +438,47 @@ def foo end it "finds a typo def" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) defzfoo puts "lol" end EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM') + expect(search.invalid_blocks.join).to eq(<<~EOM) defzfoo end EOM end it "finds a mis-matched def" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) def foo def blerg end EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) def blerg EOM end it "finds a naked end" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) def foo end # one end # two EOM search.call - expect(search.invalid_blocks.join).to eq(<<~'EOM'.indent(2)) + expect(search.invalid_blocks.join).to eq(<<~EOM.indent(2)) end # one EOM end it "returns when no invalid blocks are found" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) def foo puts 'lol' end @@ -489,14 +489,14 @@ def foo end it "expands frontier by eliminating valid lines" do - search = CodeSearch.new(<<~'EOM') + search = CodeSearch.new(<<~EOM) def foo puts 'lol' end EOM search.create_blocks_from_untracked_lines - expect(search.code_lines.join).to eq(<<~'EOM') + expect(search.code_lines.join).to eq(<<~EOM) def foo end EOM diff --git a/spec/unit/core_ext_spec.rb b/spec/unit/core_ext_spec.rb index 802d03e..499c38a 100644 --- a/spec/unit/core_ext_spec.rb +++ b/spec/unit/core_ext_spec.rb @@ -8,7 +8,7 @@ module SyntaxSuggest Dir.mktmpdir do |dir| tmpdir = Pathname(dir) file = tmpdir.join("file.rb") - file.write(<<~'EOM'.strip) + file.write(<<~EOM.strip) print 'no newline EOM