]> gitweb.factorcode.org Git - factor.git/blob - core/splitting/splitting-tests.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / core / splitting / splitting-tests.factor
1 USING: splitting tools.test kernel sequences arrays ;
2 IN: splitting.tests
3
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
8
9 [ "hello world" "." ] [ "hello world ." " " last-split1 ] unit-test
10 [ "hello-+world" "." ] [ "hello-+world-+." "-+" last-split1 ] unit-test
11 [ "goodbye" f ] [ "goodbye" " " last-split1 ] unit-test
12 [ "" "" ] [ "great" "great" last-split1 ] unit-test
13
14 [ "and end" t ] [ "Beginning and end" "Beginning " ?head ] unit-test
15 [ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?head ] unit-test
16 [ "Beginning and end" f ] [ "Beginning and end" "eginning " ?head ] unit-test
17
18 [ "Beginning" t ] [ "Beginning and end" " and end" ?tail ] unit-test
19 [ "Beginning and end" f ] [ "Beginning and end" "Beginning x" ?tail ] unit-test
20 [ "Beginning and end" f ] [ "Beginning and end" "eginning " ?tail ] unit-test
21
22 [ { "This" "is" "a" "split" "sentence" } ]
23 [ "This is a split sentence" " " split ]
24 unit-test
25
26 [ { "OneWord" } ]
27 [ "OneWord" " " split ]
28 unit-test
29
30 [ { "a" "b" "c" "d" "e" "f" } ]
31 [ "aXbYcXdYeXf" "XY" split ] unit-test
32
33 [ { "" "" } ]
34 [ " " " " split ] unit-test
35
36 [ { "hey" } ]
37 [ "hey" " " split ] unit-test
38
39 [ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
40 [ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
41 [ "" t ] [ "\n" "\n" ?tail ] unit-test
42 [ "" f ] [ "" "\n" ?tail ] unit-test
43
44 [ { "" } ] [ "" string-lines ] unit-test
45 [ { "" "" } ] [ "\n" string-lines ] unit-test
46 [ { "" "" } ] [ "\r" string-lines ] unit-test
47 [ { "" "" } ] [ "\r\n" string-lines ] unit-test
48 [ { "hello" } ] [ "hello" string-lines ] unit-test
49 [ { "hello" "" } ] [ "hello\n" string-lines ] unit-test
50 [ { "hello" "" } ] [ "hello\r" string-lines ] unit-test
51 [ { "hello" "" } ] [ "hello\r\n" string-lines ] unit-test
52 [ { "hello" "hi" } ] [ "hello\nhi" string-lines ] unit-test
53 [ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test
54 [ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test