Class | WadlerExample |
In: |
prettyprint.rb
|
Parent: | Test::Unit::TestCase |
# File prettyprint.rb, line 412 def hello(width) PrettyPrint.format('', width) {|hello| hello.group { hello.group { hello.group { hello.group { hello.text 'hello' hello.breakable; hello.text 'a' } hello.breakable; hello.text 'b' } hello.breakable; hello.text 'c' } hello.breakable; hello.text 'd' } } end
# File prettyprint.rb, line 403 def setup @tree = Tree.new("aaaa", Tree.new("bbbbb", Tree.new("ccc"), Tree.new("dd")), Tree.new("eee"), Tree.new("ffff", Tree.new("gg"), Tree.new("hhh"), Tree.new("ii"))) end
# File prettyprint.rb, line 430 def test_hello_00_06 expected = "hello\na\nb\nc\nd\n".chomp assert_equal(expected, hello(0)) assert_equal(expected, hello(6)) end
# File prettyprint.rb, line 443 def test_hello_07_08 expected = "hello a\nb\nc\nd\n".chomp assert_equal(expected, hello(7)) assert_equal(expected, hello(8)) end
# File prettyprint.rb, line 455 def test_hello_09_10 expected = "hello a b\nc\nd\n".chomp out = hello(9); assert_equal(expected, out) out = hello(10); assert_equal(expected, out) end
# File prettyprint.rb, line 466 def test_hello_11_12 expected = "hello a b c\nd\n".chomp assert_equal(expected, hello(11)) assert_equal(expected, hello(12)) end
# File prettyprint.rb, line 476 def test_hello_13 expected = "hello a b c d\n".chomp assert_equal(expected, hello(13)) end
# File prettyprint.rb, line 488 def test_tree_00_19 expected = "aaaa[bbbbb[ccc,\n dd],\n eee,\n ffff[gg,\n hhh,\n ii]]\n".chomp assert_equal(expected, tree(0)) assert_equal(expected, tree(19)) end
# File prettyprint.rb, line 502 def test_tree_20_22 expected = "aaaa[bbbbb[ccc, dd],\n eee,\n ffff[gg,\n hhh,\n ii]]\n".chomp assert_equal(expected, tree(20)) assert_equal(expected, tree(22)) end
# File prettyprint.rb, line 515 def test_tree_23_43 expected = "aaaa[bbbbb[ccc, dd],\n eee,\n ffff[gg, hhh, ii]]\n".chomp assert_equal(expected, tree(23)) assert_equal(expected, tree(43)) end
# File prettyprint.rb, line 526 def test_tree_44 assert_equal("aaaa[bbbbb[ccc, dd], eee, ffff[gg, hhh, ii]]\n".chomp, tree(44)) end
# File prettyprint.rb, line 537 def test_tree_alt_00_18 expected = "aaaa[\n bbbbb[\n ccc,\n dd\n ],\n eee,\n ffff[\n gg,\n hhh,\n ii\n ]\n]\n".chomp assert_equal(expected, tree_alt(0)) assert_equal(expected, tree_alt(18)) end
# File prettyprint.rb, line 557 def test_tree_alt_19_20 expected = "aaaa[\n bbbbb[ ccc, dd ],\n eee,\n ffff[\n gg,\n hhh,\n ii\n ]\n]\n".chomp assert_equal(expected, tree_alt(19)) assert_equal(expected, tree_alt(20)) end
# File prettyprint.rb, line 574 def test_tree_alt_20_49 expected = "aaaa[\n bbbbb[ ccc, dd ],\n eee,\n ffff[ gg, hhh, ii ]\n]\n".chomp assert_equal(expected, tree_alt(21)) assert_equal(expected, tree_alt(49)) end
# File prettyprint.rb, line 587 def test_tree_alt_50 expected = "aaaa[ bbbbb[ ccc, dd ], eee, ffff[ gg, hhh, ii ] ]\n".chomp assert_equal(expected, tree_alt(50)) end
# File prettyprint.rb, line 484 def tree(width) PrettyPrint.format('', width) {|q| @tree.show(q)} end