Class | StrictPrettyExample
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 653
        def prog(width)
          PrettyPrint.format('', width) {|q|
            q.group {
              q.group {q.nest(2) {
                           q.text "if"; q.breakable;
                           q.group {
                             q.nest(2) {
                               q.group {q.text "a"; q.breakable; q.text "=="}
                               q.breakable; q.text "b"}}}}
              q.breakable
              q.group {q.nest(2) {
                           q.text "then"; q.breakable;
                           q.group {
                             q.nest(2) {
                               q.group {q.text "a"; q.breakable; q.text "<<"}
                               q.breakable; q.text "2"}}}}
              q.breakable
              q.group {q.nest(2) {
                           q.text "else"; q.breakable;
                           q.group {
                             q.nest(2) {
                               q.group {q.text "a"; q.breakable; q.text "+"}
                               q.breakable; q.text "b"}}}}}
          }
        end

test_00_04()

[Source]

    # File prettyprint.rb, line 679
        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 699
        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 717
        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 733
        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 748
        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 761
        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 773
        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 784
        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 796
        def test_32
          expected = "if a == b then a << 2 else a + b\n".chomp
          assert_equal(expected, prog(32))
        end

[Validate]