1 ! Copyright (C) 2008, 2009 Daniel Ehrenberg, Slava Pestov
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: wrap.strings tools.test multiline ;
14 <" This is a long piece of text that we wish to word wrap."> 10
26 <" This is a long piece of text that we wish to word wrap."> 12
27 " " wrap-indented-string
30 [ "this text\nhas lots of\nspaces" ]
31 [ "this text has lots of spaces" 12 wrap-string ] unit-test
33 [ "hello\nhow\nare\nyou\ntoday?" ]
34 [ "hello how are you today?" 3 wrap-string ] unit-test
36 [ "aaa\nbb cc\nddddd" ] [ "aaa bb cc ddddd" 6 wrap-string ] unit-test
37 [ "aaa\nbb ccc\ndddddd" ] [ "aaa bb ccc dddddd" 6 wrap-string ] unit-test
38 [ "aaa bb\ncccc\nddddd" ] [ "aaa bb cccc ddddd" 6 wrap-string ] unit-test
39 [ "aaa bb\nccccccc\nddddddd" ] [ "aaa bb ccccccc ddddddd" 6 wrap-string ] unit-test
41 [ "a b c d e f\ng h" ] [ "a b c d e f g h" 11 wrap-string ] unit-test