mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
fix pry indent frozen error (#2136)
* fix pry indent frozen error * fix generation of mutable strings * fix String.new with no argument * rubocop: fix offences of the Style/EmptyLiteral cop
This commit is contained in:
parent
332255a395
commit
5590e095ae
2 changed files with 9 additions and 1 deletions
|
@ -109,7 +109,7 @@ class Pry
|
|||
# reset internal state
|
||||
def reset
|
||||
@stack = []
|
||||
@indent_level = ''
|
||||
@indent_level = String.new # rubocop:disable Style/EmptyLiteral
|
||||
@heredoc_queue = []
|
||||
@close_heredocs = {}
|
||||
@string_start = nil
|
||||
|
|
|
@ -305,6 +305,14 @@ OUTPUT
|
|||
expect(@indent.indent(input)).to eq output
|
||||
end
|
||||
|
||||
it "should not raise error, if MIDWAY_TOKENS are used without indentation" do
|
||||
expect { @indent.indent("when") }.not_to raise_error
|
||||
expect { @indent.reset.indent("else") }.not_to raise_error
|
||||
expect { @indent.reset.indent("elsif") }.not_to raise_error
|
||||
expect { @indent.reset.indent("ensure") }.not_to raise_error
|
||||
expect { @indent.reset.indent("rescue") }.not_to raise_error
|
||||
end
|
||||
|
||||
describe "nesting" do
|
||||
test = File.read("spec/fixtures/example_nesting.rb")
|
||||
|
||||
|
|
Loading…
Reference in a new issue