diff options
Diffstat (limited to 'spec/syntax_suggest/unit/block_expand_spec.rb')
-rw-r--r-- | spec/syntax_suggest/unit/block_expand_spec.rb | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/spec/syntax_suggest/unit/block_expand_spec.rb b/spec/syntax_suggest/unit/block_expand_spec.rb index ba0b0457a1..fde0360775 100644 --- a/spec/syntax_suggest/unit/block_expand_spec.rb +++ b/spec/syntax_suggest/unit/block_expand_spec.rb @@ -4,6 +4,36 @@ require_relative "../spec_helper" module SyntaxSuggest RSpec.describe BlockExpand do + it "empty line in methods" do + source_string = <<~EOM + class Dog # index 0 + def bark # index 1 + + end # index 3 + + def sit # index 5 + print "sit" # index 6 + end # index 7 + end # index 8 + end # extra end + EOM + + code_lines = code_line_array(source_string) + + sit = code_lines[4..7] + sit.each(&:mark_invisible) + + block = CodeBlock.new(lines: sit) + expansion = BlockExpand.new(code_lines: code_lines) + block = expansion.expand_neighbors(block) + + expect(block.to_s).to eq(<<~EOM.indent(2)) + def bark # index 1 + + end # index 3 + EOM + end + it "captures multiple empty and hidden lines" do source_string = <<~EOM def foo @@ -116,7 +146,7 @@ module SyntaxSuggest EOM end - it "expand until next boundry (indentation)" do + it "expand until next boundary (indentation)" do source_string = <<~EOM describe "what" do Foo.call @@ -158,7 +188,7 @@ module SyntaxSuggest EOM end - it "expand until next boundry (empty lines)" do + it "expand until next boundary (empty lines)" do source_string = <<~EOM describe "what" do end |