1
0
Fork 0
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:
T.Yasuma 2021-10-11 18:10:14 +09:00 committed by GitHub
parent 332255a395
commit 5590e095ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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")