Class: Fill

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/prettyprint.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#format(width) ⇒ Object



806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/prettyprint.rb', line 806

def format(width)
  PrettyPrint.format('', width) {|q|
    q.group {
      q.text 'abc'
      q.fill_breakable
      q.text 'def'
      q.fill_breakable
      q.text 'ghi'
      q.fill_breakable
      q.text 'jkl'
      q.fill_breakable
      q.text 'mno'
      q.fill_breakable
      q.text 'pqr'
      q.fill_breakable
      q.text 'stu'
    }
  }
end

#test_00_06Object



826
827
828
829
830
831
832
833
834
835
836
837
838
# File 'lib/prettyprint.rb', line 826

def test_00_06
  expected = <<'End'.chomp
abc
def
ghi
jkl
mno
pqr
stu
End
  assert_equal(expected, format(0))
  assert_equal(expected, format(6))
end

#test_07_10Object



840
841
842
843
844
845
846
847
848
849
# File 'lib/prettyprint.rb', line 840

def test_07_10
  expected = <<'End'.chomp
abc def
ghi jkl
mno pqr
stu
End
  assert_equal(expected, format(7))
  assert_equal(expected, format(10))
end

#test_11_14Object



851
852
853
854
855
856
857
858
859
# File 'lib/prettyprint.rb', line 851

def test_11_14
  expected = <<'End'.chomp
abc def ghi
jkl mno pqr
stu
End
  assert_equal(expected, format(11))
  assert_equal(expected, format(14))
end

#test_15_18Object



861
862
863
864
865
866
867
868
# File 'lib/prettyprint.rb', line 861

def test_15_18
  expected = <<'End'.chomp
abc def ghi jkl
mno pqr stu
End
  assert_equal(expected, format(15))
  assert_equal(expected, format(18))
end

#test_19_22Object



870
871
872
873
874
875
876
877
# File 'lib/prettyprint.rb', line 870

def test_19_22
  expected = <<'End'.chomp
abc def ghi jkl mno
pqr stu
End
  assert_equal(expected, format(19))
  assert_equal(expected, format(22))
end

#test_23_26Object



879
880
881
882
883
884
885
886
# File 'lib/prettyprint.rb', line 879

def test_23_26
  expected = <<'End'.chomp
abc def ghi jkl mno pqr
stu
End
  assert_equal(expected, format(23))
  assert_equal(expected, format(26))
end

#test_27Object



888
889
890
891
892
893
# File 'lib/prettyprint.rb', line 888

def test_27
  expected = <<'End'.chomp
abc def ghi jkl mno pqr stu
End
  assert_equal(expected, format(27))
end