diff options
author | schneems <richard.schneeman+foo@gmail.com> | 2023-03-08 18:30:33 -0600 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-04-06 15:45:29 +0900 |
commit | 2acbcec056f54df9b4d98d4d15b1e9f612ac1432 (patch) | |
tree | a68919e7725c1ca706c5a62c4e63e2354acd041f /spec/syntax_suggest | |
parent | 5487ee4fe8b1311d42367969860468e48667cc87 (diff) | |
download | ruby-2acbcec056f54df9b4d98d4d15b1e9f612ac1432.tar.gz |
[ruby/syntax_suggest] Add comments and refactor AroundBlockScan methods
https://github.com/ruby/syntax_suggest/commit/cecd12292c
Diffstat (limited to 'spec/syntax_suggest')
-rw-r--r-- | spec/syntax_suggest/integration/syntax_suggest_spec.rb | 52 | ||||
-rw-r--r-- | spec/syntax_suggest/unit/around_block_scan_spec.rb | 4 |
2 files changed, 2 insertions, 54 deletions
diff --git a/spec/syntax_suggest/integration/syntax_suggest_spec.rb b/spec/syntax_suggest/integration/syntax_suggest_spec.rb index e96173717d..bb50fafce7 100644 --- a/spec/syntax_suggest/integration/syntax_suggest_spec.rb +++ b/spec/syntax_suggest/integration/syntax_suggest_spec.rb @@ -207,57 +207,5 @@ module SyntaxSuggest > 4 end EOM end - - it "comment inside of a method" do - source = <<~'EOM' - class Dog - def bark - # todo - end - - def sit - print "sit" - end - end - end # extra end - EOM - - io = StringIO.new - SyntaxSuggest.call( - io: io, - source: source - ) - out = io.string - expect(out).to include(<<~EOM) - > 1 class Dog - > 9 end - > 10 end # extra end - EOM - end - - it "space inside of a method" do - source = <<~'EOM' - class Dog # 1 - def bark # 2 - - end # 4 - - def sit # 6 - print "sit" # 7 - end # 8 - end # 9 - end # extra end - EOM - - io = StringIO.new - SyntaxSuggest.call( - io: io, - source: source - ) - out = io.string - expect(out).to include(<<~EOM) - > 10 end # extra end - EOM - end end end diff --git a/spec/syntax_suggest/unit/around_block_scan_spec.rb b/spec/syntax_suggest/unit/around_block_scan_spec.rb index be1c3a4780..88d973e151 100644 --- a/spec/syntax_suggest/unit/around_block_scan_spec.rb +++ b/spec/syntax_suggest/unit/around_block_scan_spec.rb @@ -149,8 +149,8 @@ module SyntaxSuggest block = CodeBlock.new(lines: code_lines[3]) expand = AroundBlockScan.new(code_lines: code_lines, block: block) - expand.skip(:empty?) - expand.skip(:hidden?) + expand.force_add_empty + expand.force_add_hidden expand.scan_neighbors_not_empty expect(expand.code_block.to_s).to eq(<<~EOM.indent(4)) |