1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #1329 from lowensk/issue-1325-single-line-if

Prevent additional single-line if indentations [Fixes #1325]
This commit is contained in:
Conrad Irwin 2014-12-04 09:06:32 -08:00
commit 9afc501b41
2 changed files with 7 additions and 2 deletions

View file

@ -66,8 +66,10 @@ class Pry
#
# :reserved and :keywords are the CodeRay 0.9.8 and 1.0.0 respectively
# classifications of "super", "next", "return", etc.
STATEMENT_END_TOKENS = IGNORE_TOKENS + [:regexp, :integer, :float, :keyword,
:delimiter, :reserved]
STATEMENT_END_TOKENS = IGNORE_TOKENS + [:regexp, :integer, :float,
:keyword, :delimiter, :reserved,
:instance_variable,
:class_variable, :global_variable]
# Collection of tokens that should appear dedented even though they
# don't affect the surrounding code.

View file

@ -200,6 +200,9 @@ TXT
@indent.reset.indent("foo() if bar\n#").should == "foo() if bar\n#"
@indent.reset.indent("foo 'hi' if bar\n#").should == "foo 'hi' if bar\n#"
@indent.reset.indent("foo 1 while bar\n#").should == "foo 1 while bar\n#"
@indent.reset.indent("$foo if false\n#").should == "$foo if false\n#"
@indent.reset.indent("@foo if false\n#").should == "@foo if false\n#"
@indent.reset.indent("@@foo if false\n#").should == "@@foo if false\n#"
@indent.reset.indent("super if true\n#").should == "super if true\n#"
@indent.reset.indent("true if false\n#").should == "true if false\n#"
@indent.reset.indent("String if false\n#").should == "String if false\n#"