1 USING: splitting tools.test kernel sequences arrays strings ;
4 [ "hello" "world ." ] [ "hello world ." " " split1 ] unit-test
5 [ "hello" "world-+." ] [ "hello-+world-+." "-+" split1 ] unit-test
6 [ "goodbye" f ] [ "goodbye" " " split1 ] unit-test
7 [ "" "" ] [ "great" "great" split1 ] unit-test
9 [ "hello world" "." ] [ "hello world ." " " split1-last ] unit-test
10 [ "hello-+world" "." ] [ "hello-+world-+." "-+" split1-last ] unit-test
11 [ "goodbye" f ] [ "goodbye" " " split1-last ] unit-test
12 [ "" "" ] [ "great" "great" split1-last ] unit-test
14 [ "hello world" "." ] [ "hello world ." " " split1-last-slice [ >string ] bi@ ] unit-test
15 [ "hello-+world" "." ] [ "hello-+world-+." "-+" split1-last-slice [ >string ] bi@ ] unit-test
16 [ "goodbye" f ] [ "goodbye" " " split1-last-slice [ >string ] dip ] unit-test
17 [ "" f ] [ "great" "great" split1-last-slice [ >string ] dip ] unit-test
19 [ "and end" t ] [ "Beginning and end" "Beginning " ?head ] unit-test
20 [ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?head ] unit-test
21 [ "Beginning and end" f ] [ "Beginning and end" "eginning " ?head ] unit-test
23 [ "Beginning" t ] [ "Beginning and end" " and end" ?tail ] unit-test
24 [ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?tail ] unit-test
25 [ "Beginning and end" f ] [ "Beginning and end" "eginning " ?tail ] unit-test
27 [ { "This" "is" "a" "split" "sentence" } ]
28 [ "This is a split sentence" " " split ]
32 [ "OneWord" " " split ]
35 [ { "a" "b" "c" "d" "e" "f" } ]
36 [ "aXbYcXdYeXf" "XY" split ] unit-test
39 [ " " " " split ] unit-test
42 [ "hey" " " split ] unit-test
44 [ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
45 [ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
46 [ "" t ] [ "\n" "\n" ?tail ] unit-test
47 [ "" f ] [ "" "\n" ?tail ] unit-test
49 [ { "" } ] [ "" string-lines ] unit-test
50 [ { "" "" } ] [ "\n" string-lines ] unit-test
51 [ { "" "" } ] [ "\r" string-lines ] unit-test
52 [ { "" "" } ] [ "\r\n" string-lines ] unit-test
53 [ { "hello" } ] [ "hello" string-lines ] unit-test
54 [ { "hello" "" } ] [ "hello\n" string-lines ] unit-test
55 [ { "hello" "" } ] [ "hello\r" string-lines ] unit-test
56 [ { "hello" "" } ] [ "hello\r\n" string-lines ] unit-test
57 [ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
58 [ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
59 [ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test