Class WadlerExample
In: lib/prettyprint.rb
Parent: Test::Unit::TestCase

Methods

Classes and Modules

Class WadlerExample::Tree

Public Instance methods

[Source]

     # File lib/prettyprint.rb, line 394
394:     def hello(width)
395:       PrettyPrint.format('', width) {|hello|
396:         hello.group {
397:           hello.group {
398:             hello.group {
399:               hello.group {
400:                 hello.text 'hello'
401:                 hello.breakable; hello.text 'a'
402:               }
403:               hello.breakable; hello.text 'b'
404:             }
405:             hello.breakable; hello.text 'c'
406:           }
407:           hello.breakable; hello.text 'd'
408:         }
409:       }
410:     end

[Source]

     # File lib/prettyprint.rb, line 385
385:     def setup
386:       @tree = Tree.new("aaaa", Tree.new("bbbbb", Tree.new("ccc"),
387:                                                  Tree.new("dd")),
388:                                Tree.new("eee"),
389:                                Tree.new("ffff", Tree.new("gg"),
390:                                                 Tree.new("hhh"),
391:                                                 Tree.new("ii")))
392:     end

[Source]

     # File lib/prettyprint.rb, line 412
412:     def test_hello_00_06
413:       expected = "hello\na\nb\nc\nd\n".chomp
414:       assert_equal(expected, hello(0))
415:       assert_equal(expected, hello(6))
416:     end

[Source]

     # File lib/prettyprint.rb, line 425
425:     def test_hello_07_08
426:       expected = "hello a\nb\nc\nd\n".chomp
427:       assert_equal(expected, hello(7))
428:       assert_equal(expected, hello(8))
429:     end

[Source]

     # File lib/prettyprint.rb, line 437
437:     def test_hello_09_10
438:       expected = "hello a b\nc\nd\n".chomp
439:       out = hello(9); assert_equal(expected, out)
440:       out = hello(10); assert_equal(expected, out)
441:     end

[Source]

     # File lib/prettyprint.rb, line 448
448:     def test_hello_11_12
449:       expected = "hello a b c\nd\n".chomp
450:       assert_equal(expected, hello(11))
451:       assert_equal(expected, hello(12))
452:     end

[Source]

     # File lib/prettyprint.rb, line 458
458:     def test_hello_13
459:       expected = "hello a b c d\n".chomp
460:       assert_equal(expected, hello(13))
461:     end

[Source]

     # File lib/prettyprint.rb, line 470
470:     def test_tree_00_19
471:       expected = "aaaa[bbbbb[ccc,\n           dd],\n     eee,\n     ffff[gg,\n          hhh,\n          ii]]\n".chomp
472:       assert_equal(expected, tree(0))
473:       assert_equal(expected, tree(19))
474:     end

[Source]

     # File lib/prettyprint.rb, line 484
484:     def test_tree_20_22
485:       expected = "aaaa[bbbbb[ccc, dd],\n     eee,\n     ffff[gg,\n          hhh,\n          ii]]\n".chomp
486:       assert_equal(expected, tree(20))
487:       assert_equal(expected, tree(22))
488:     end

[Source]

     # File lib/prettyprint.rb, line 497
497:     def test_tree_23_43
498:       expected = "aaaa[bbbbb[ccc, dd],\n     eee,\n     ffff[gg, hhh, ii]]\n".chomp
499:       assert_equal(expected, tree(23))
500:       assert_equal(expected, tree(43))
501:     end

[Source]

     # File lib/prettyprint.rb, line 508
508:     def test_tree_44
509:       assert_equal("aaaa[bbbbb[ccc, dd], eee, ffff[gg, hhh, ii]]\n".chomp, tree(44))
510:     end

[Source]

     # File lib/prettyprint.rb, line 519
519:     def test_tree_alt_00_18
520:       expected = "aaaa[\n  bbbbb[\n    ccc,\n    dd\n  ],\n  eee,\n  ffff[\n    gg,\n    hhh,\n    ii\n  ]\n]\n".chomp
521:       assert_equal(expected, tree_alt(0))
522:       assert_equal(expected, tree_alt(18))
523:     end

[Source]

     # File lib/prettyprint.rb, line 539
539:     def test_tree_alt_19_20
540:       expected = "aaaa[\n  bbbbb[ ccc, dd ],\n  eee,\n  ffff[\n    gg,\n    hhh,\n    ii\n  ]\n]\n".chomp
541:       assert_equal(expected, tree_alt(19))
542:       assert_equal(expected, tree_alt(20))
543:     end

[Source]

     # File lib/prettyprint.rb, line 556
556:     def test_tree_alt_20_49
557:       expected = "aaaa[\n  bbbbb[ ccc, dd ],\n  eee,\n  ffff[ gg, hhh, ii ]\n]\n".chomp
558:       assert_equal(expected, tree_alt(21))
559:       assert_equal(expected, tree_alt(49))
560:     end

[Source]

     # File lib/prettyprint.rb, line 569
569:     def test_tree_alt_50
570:       expected = "aaaa[ bbbbb[ ccc, dd ], eee, ffff[ gg, hhh, ii ] ]\n".chomp
571:       assert_equal(expected, tree_alt(50))
572:     end

[Source]

     # File lib/prettyprint.rb, line 466
466:     def tree(width)
467:       PrettyPrint.format('', width) {|q| @tree.show(q)}
468:     end

[Source]

     # File lib/prettyprint.rb, line 515
515:     def tree_alt(width)
516:       PrettyPrint.format('', width) {|q| @tree.altshow(q)}
517:     end

[Validate]