diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-03-14 03:21:29 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-04-29 23:43:26 -0300 |
commit | e5404880ed9d0505ba4d856408a600fa219f7127 (patch) | |
tree | c655dbf39b1a34ef13830a3e16af5b4a872c8ca2 | |
parent | 1dae887af2e2cff6a343a383315d39dfa2e0e8a3 (diff) | |
download | highline-e5404880ed9d0505ba4d856408a600fa219f7127.tar.gz |
Add test for patially colored middle word wrapping
-rw-r--r-- | test/test_wrapper.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_wrapper.rb b/test/test_wrapper.rb index ae31387..4c4e289 100644 --- a/test/test_wrapper.rb +++ b/test/test_wrapper.rb @@ -123,4 +123,28 @@ class TestHighLineWrapper < Minitest::Test end end end + + def test_wrap_middle_partially_colored_text_on_the_right_place + skip "TODO: Implement middle partially colored text wrapping!" + line = "123 567 9\e[31m0\e[0m1 345" + + 1.upto(25) do |wrap_at| + wrapped = HighLine::Wrapper.wrap(line, wrap_at) + + case wrap_at + when 1 + assert_equal "1\n2\n3\n5\n6\n7\n9\n\e[31m0\e[0m\n1\n3\n4\n5", wrapped + when 2 + assert_equal "12\n3\n56\n7\n9\e[31m0\e[0m\n1\n34\n5", wrapped + when 3..6 + assert_equal "123\n567\n9\e[31m0\e[0m1\n345", wrapped + when 7..10 + assert_equal "123 567\n9\e[31m0\e[0m1 345", wrapped + when 11..14 + assert_equal "123 567 9\e[31m0\e[0m1\n345", wrapped + when 15..25 + assert_equal "123 567 9\e[31m0\e[0m1 345", wrapped + end + end + end end
\ No newline at end of file |