Fix indentation of "true if foo" [Fixes #355]
This commit is contained in:
parent
ddae9fbfb0
commit
6f54733e1d
|
@ -43,7 +43,11 @@ class Pry
|
|||
# Collection of token types that should be ignored. Without this list
|
||||
# keywords such as "class" inside strings would cause the code to be
|
||||
# indented incorrectly.
|
||||
IGNORE_TOKENS = [:space, :content, :string, :delimiter, :method, :ident]
|
||||
#
|
||||
# :pre_constant and :preserved_constant are the CodeRay 0.9.8 and 1.0.0
|
||||
# classifications of "true", "false", and "nil".
|
||||
IGNORE_TOKENS = [:space, :content, :string, :delimiter, :method, :ident,
|
||||
:constant, :pre_constant, :predefined_constant]
|
||||
|
||||
# Tokens that indicate the end of a statement (i.e. that, if they appear
|
||||
# directly before an "if" indicates that that if applies to the same line,
|
||||
|
|
|
@ -196,6 +196,8 @@ TXT
|
|||
@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("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#"
|
||||
end
|
||||
|
||||
it "should indent cunningly disguised ifs" do
|
||||
|
|
Loading…
Reference in New Issue