1
0
Fork 0
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:
Mike Dvorkin 2011-11-08 17:05:24 -08:00
parent ac5c9fa043
commit 782e38268b
2 changed files with 4 additions and 4 deletions

View file

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

View file

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