aboutsummaryrefslogtreecommitdiffstats
path: root/spec/syntax_suggest/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/syntax_suggest/unit')
-rw-r--r--spec/syntax_suggest/unit/around_block_scan_spec.rb2
-rw-r--r--spec/syntax_suggest/unit/capture/before_after_keyword_ends_spec.rb4
-rw-r--r--spec/syntax_suggest/unit/capture/falling_indent_lines_spec.rb4
-rw-r--r--spec/syntax_suggest/unit/capture_code_context_spec.rb28
-rw-r--r--spec/syntax_suggest/unit/clean_document_spec.rb6
-rw-r--r--spec/syntax_suggest/unit/code_line_spec.rb12
-rw-r--r--spec/syntax_suggest/unit/code_search_spec.rb82
-rw-r--r--spec/syntax_suggest/unit/core_ext_spec.rb2
-rw-r--r--spec/syntax_suggest/unit/scan_history_spec.rb6
9 files changed, 73 insertions, 73 deletions
diff --git a/spec/syntax_suggest/unit/around_block_scan_spec.rb b/spec/syntax_suggest/unit/around_block_scan_spec.rb
index d6756448bd..6c940a5919 100644
--- a/spec/syntax_suggest/unit/around_block_scan_spec.rb
+++ b/spec/syntax_suggest/unit/around_block_scan_spec.rb
@@ -5,7 +5,7 @@ require_relative "../spec_helper"
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/syntax_suggest/unit/capture/before_after_keyword_ends_spec.rb b/spec/syntax_suggest/unit/capture/before_after_keyword_ends_spec.rb
index 02d9be4387..09f8d90d33 100644
--- a/spec/syntax_suggest/unit/capture/before_after_keyword_ends_spec.rb
+++ b/spec/syntax_suggest/unit/capture/before_after_keyword_ends_spec.rb
@@ -5,7 +5,7 @@ require_relative "../../spec_helper"
module SyntaxSuggest
RSpec.describe Capture::BeforeAfterKeywordEnds do
it "before after keyword ends" do
- source = <<~'EOM'
+ source = <<~EOM
def nope
print 'not me'
end
@@ -36,7 +36,7 @@ module SyntaxSuggest
).call
lines.sort!
- expect(lines.join).to include(<<~'EOM')
+ expect(lines.join).to include(<<~EOM)
def lol
end
def yolo
diff --git a/spec/syntax_suggest/unit/capture/falling_indent_lines_spec.rb b/spec/syntax_suggest/unit/capture/falling_indent_lines_spec.rb
index 61d1642d97..ed2265539a 100644
--- a/spec/syntax_suggest/unit/capture/falling_indent_lines_spec.rb
+++ b/spec/syntax_suggest/unit/capture/falling_indent_lines_spec.rb
@@ -5,7 +5,7 @@ require_relative "../../spec_helper"
module SyntaxSuggest
RSpec.describe Capture::FallingIndentLines do
it "on_falling_indent" do
- source = <<~'EOM'
+ source = <<~EOM
class OH
def lol
print 'lol
@@ -33,7 +33,7 @@ module SyntaxSuggest
end
lines.sort!
- expect(lines.join).to eq(<<~'EOM')
+ expect(lines.join).to eq(<<~EOM)
class OH
def hello
end
diff --git a/spec/syntax_suggest/unit/capture_code_context_spec.rb b/spec/syntax_suggest/unit/capture_code_context_spec.rb
index 0e70f1f1e2..d9379d0ce7 100644
--- a/spec/syntax_suggest/unit/capture_code_context_spec.rb
+++ b/spec/syntax_suggest/unit/capture_code_context_spec.rb
@@ -5,7 +5,7 @@ require_relative "../spec_helper"
module SyntaxSuggest
RSpec.describe CaptureCodeContext do
it "capture_before_after_kws two" do
- source = <<~'EOM'
+ source = <<~EOM
class OH
def hello
@@ -23,7 +23,7 @@ module SyntaxSuggest
code_lines: code_lines
)
display.capture_before_after_kws(block)
- expect(display.sorted_lines.join).to eq(<<~'EOM'.indent(2))
+ expect(display.sorted_lines.join).to eq(<<~EOM.indent(2))
def hello
def hai
end
@@ -31,7 +31,7 @@ module SyntaxSuggest
end
it "capture_before_after_kws" do
- source = <<~'EOM'
+ source = <<~EOM
def sit
end
@@ -50,7 +50,7 @@ module SyntaxSuggest
)
lines = display.capture_before_after_kws(block).sort
- expect(lines.join).to eq(<<~'EOM')
+ expect(lines.join).to eq(<<~EOM)
def sit
end
def bark
@@ -60,7 +60,7 @@ module SyntaxSuggest
end
it "handles ambiguous end" do
- source = <<~'EOM'
+ source = <<~EOM
def call # 0
print "lol" # 1
end # one # 2
@@ -79,7 +79,7 @@ module SyntaxSuggest
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
@@ -106,7 +106,7 @@ module SyntaxSuggest
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
@@ -114,7 +114,7 @@ module SyntaxSuggest
end
it "shows ends of captured block" do
- source = <<~'EOM'
+ source = <<~EOM
class Dog
def bark
puts "woof"
@@ -132,7 +132,7 @@ module SyntaxSuggest
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
@@ -140,7 +140,7 @@ module SyntaxSuggest
end
it "captures surrounding context on falling indent" do
- source = <<~'EOM'
+ source = <<~EOM
class Blerg
end
@@ -164,7 +164,7 @@ module SyntaxSuggest
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
@@ -174,7 +174,7 @@ module SyntaxSuggest
end
it "captures surrounding context on same indent" do
- source = <<~'EOM'
+ source = <<~EOM
class Blerg
end
class OH
@@ -200,7 +200,7 @@ module SyntaxSuggest
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
@@ -217,7 +217,7 @@ module SyntaxSuggest
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/syntax_suggest/unit/clean_document_spec.rb b/spec/syntax_suggest/unit/clean_document_spec.rb
index d6ba8f0d47..c531c199b1 100644
--- a/spec/syntax_suggest/unit/clean_document_spec.rb
+++ b/spec/syntax_suggest/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/syntax_suggest/unit/code_line_spec.rb b/spec/syntax_suggest/unit/code_line_spec.rb
index d5b568fd19..5b62cc2757 100644
--- a/spec/syntax_suggest/unit/code_line_spec.rb
+++ b/spec/syntax_suggest/unit/code_line_spec.rb
@@ -5,7 +5,7 @@ require_relative "../spec_helper"
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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/syntax_suggest/unit/code_search_spec.rb b/spec/syntax_suggest/unit/code_search_spec.rb
index f836ba36f3..502de14d7f 100644
--- a/spec/syntax_suggest/unit/code_search_spec.rb
+++ b/spec/syntax_suggest/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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
end
it "def with missing end" do
- search = CodeSearch.new(<<~'EOM')
+ search = CodeSearch.new(<<~EOM)
class OH
def hello
@@ -206,7 +206,7 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
end
it "stacked ends " do
- search = CodeSearch.new(<<~'EOM')
+ search = CodeSearch.new(<<~EOM)
Foo.call
def foo
puts "lol"
@@ -358,14 +358,14 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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 @@ module SyntaxSuggest
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/syntax_suggest/unit/core_ext_spec.rb b/spec/syntax_suggest/unit/core_ext_spec.rb
index 802d03ecc0..499c38a240 100644
--- a/spec/syntax_suggest/unit/core_ext_spec.rb
+++ b/spec/syntax_suggest/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
diff --git a/spec/syntax_suggest/unit/scan_history_spec.rb b/spec/syntax_suggest/unit/scan_history_spec.rb
index 0e75ac66ce..d8b0a54ba6 100644
--- a/spec/syntax_suggest/unit/scan_history_spec.rb
+++ b/spec/syntax_suggest/unit/scan_history_spec.rb
@@ -5,7 +5,7 @@ require_relative "../spec_helper"
module SyntaxSuggest
RSpec.describe ScanHistory do
it "retains commits" do
- source = <<~'EOM'
+ source = <<~EOM
class OH # 0
def lol # 1
print 'lol # 2
@@ -42,7 +42,7 @@ module SyntaxSuggest
end
it "is stashable" do
- source = <<~'EOM'
+ source = <<~EOM
class OH # 0
def lol # 1
print 'lol # 2
@@ -79,7 +79,7 @@ module SyntaxSuggest
end
it "doesnt change if you dont't change it" do
- source = <<~'EOM'
+ source = <<~EOM
class OH # 0
def lol # 1
print 'lol # 2