# StrictPrettyExample (Class)

In: | prettyprint.rb
Parent: | Test::Unit::TestCase

## Methods

prog test_00_04 test_05 test_06 test_07 test_08 test_09 test_10 test_11_31 test_32

## Public Instance methods

prog(width)

[Source]

    # File prettyprint.rb, line 650
        def prog(width)
          PrettyPrint.format('', width) {|pp|
            pp.group {
              pp.group {pp.nest(2) {
                           pp.text "if"; pp.breakable;
                           pp.group {
                             pp.nest(2) {
                               pp.group {pp.text "a"; pp.breakable; pp.text "=="}
                               pp.breakable; pp.text "b"}}}}
              pp.breakable
              pp.group {pp.nest(2) {
                           pp.text "then"; pp.breakable;
                           pp.group {
                             pp.nest(2) {
                               pp.group {pp.text "a"; pp.breakable; pp.text "<<"}
                               pp.breakable; pp.text "2"}}}}
              pp.breakable
              pp.group {pp.nest(2) {
                           pp.text "else"; pp.breakable;
                           pp.group {
                             pp.nest(2) {
                               pp.group {pp.text "a"; pp.breakable; pp.text "+"}
                               pp.breakable; pp.text "b"}}}}}
          }
        end

test_00_04()

[Source]

    # File prettyprint.rb, line 676
        def test_00_04
          expected = "if\n  a\n    ==\n    b\nthen\n  a\n    <<\n    2\nelse\n  a\n    +\n    b\n".chomp
          assert_equal(expected, prog(0))
          assert_equal(expected, prog(4))
        end

test_05()

[Source]

    # File prettyprint.rb, line 696
        def test_05
          expected = "if\n  a\n    ==\n    b\nthen\n  a\n    <<\n    2\nelse\n  a +\n    b\n".chomp
          assert_equal(expected, prog(5))
        end

test_06()

[Source]

    # File prettyprint.rb, line 714
        def test_06
          expected = "if\n  a ==\n    b\nthen\n  a <<\n    2\nelse\n  a +\n    b\n".chomp
          assert_equal(expected, prog(6))
        end

test_07()

[Source]

    # File prettyprint.rb, line 730
        def test_07
          expected = "if\n  a ==\n    b\nthen\n  a <<\n    2\nelse\n  a + b\n".chomp
          assert_equal(expected, prog(7))
        end

test_08()

[Source]

    # File prettyprint.rb, line 745
        def test_08
          expected = "if\n  a == b\nthen\n  a << 2\nelse\n  a + b\n".chomp
          assert_equal(expected, prog(8))
        end

test_09()

[Source]

    # File prettyprint.rb, line 758
        def test_09
          expected = "if a == b\nthen\n  a << 2\nelse\n  a + b\n".chomp
          assert_equal(expected, prog(9))
        end

test_10()

[Source]

    # File prettyprint.rb, line 770
        def test_10
          expected = "if a == b\nthen\n  a << 2\nelse a + b\n".chomp
          assert_equal(expected, prog(10))
        end

test_11_31()

[Source]

    # File prettyprint.rb, line 781
        def test_11_31
          expected = "if a == b\nthen a << 2\nelse a + b\n".chomp
          assert_equal(expected, prog(11))
          assert_equal(expected, prog(15))
          assert_equal(expected, prog(31))
        end

test_32()

[Source]

    # File prettyprint.rb, line 793
        def test_32
          expected = "if a == b then a << 2 else a + b\n".chomp
          assert_equal(expected, prog(32))
        end

[Validate]