1 ! Copyright (C) 2008, 2009 Daniel Ehrenberg, Slava Pestov
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel tools.test wrap.strings ;
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
31 "This is a long piece of text that we wish to word wrap." 12
32 [ " " wrap-indented-string ] [ 2 wrap-indented-string ] 2bi =
35 { "this text\nhas lots of\nspaces" }
36 [ "this text has lots of spaces" 12 wrap-string ] unit-test
38 { "hello\nhow\nare\nyou\ntoday?" }
39 [ "hello how are you today?" 3 wrap-string ] unit-test
41 { "aaa\nbb cc\nddddd" } [ "aaa bb cc ddddd" 6 wrap-string ] unit-test
42 { "aaa bb\nccc\ndddddd" } [ "aaa bb ccc dddddd" 6 wrap-string ] unit-test
43 { "aaa bb\ncccc\nddddd" } [ "aaa bb cccc ddddd" 6 wrap-string ] unit-test
44 { "aaa bb\nccccccc\nddddddd" } [ "aaa bb ccccccc ddddddd" 6 wrap-string ] unit-test
46 { "a b c d e f\ng h" } [ "a b c d e f g h" 11 wrap-string ] unit-test
48 { "" } [ "" 10 wrap-string ] unit-test
49 { "Hello" } [ "\nHello\n" 10 wrap-string ] unit-test
51 { " > > > " } [ "" 70 " > > > " wrap-indented-string ] unit-test