mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Fixed double indentation for left-aligned hash keys
This commit is contained in:
parent
ac5c9fa043
commit
782e38268b
2 changed files with 4 additions and 4 deletions
|
@ -274,7 +274,7 @@ module AwesomePrint
|
|||
if @options[:indent] >= 0
|
||||
value.rjust(width)
|
||||
else
|
||||
indent + value.ljust(width)
|
||||
indent[0, -@options[:indent]] + value.ljust(width)
|
||||
end
|
||||
else
|
||||
value
|
||||
|
|
|
@ -400,9 +400,9 @@ EOS
|
|||
it "hash keys must be left aligned" do
|
||||
out = @hash.ai(:plain => true, :indent => -4)
|
||||
out.start_with?("{\n").should == true
|
||||
out.include?(' :red => "rgb(255, 0, 0)"').should == true
|
||||
out.include?(' "magenta" => "rgb(255, 0, 255)"').should == true
|
||||
out.include?(' [ 0, 0, 255 ] => :yellow').should == true
|
||||
out.match(/^\s{4}:red => "rgb\(255, 0, 0\)"/m).should_not == nil
|
||||
out.match(/^\s{4}"magenta" => "rgb\(255, 0, 255\)"/m).should_not == nil
|
||||
out.match(/^\s{4}\[ 0, 0, 255 \] => :yellow/m).should_not == nil
|
||||
out.end_with?("\n}").should == true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue