]> gitweb.factorcode.org Git - factor.git/blob - basis/simple-tokenizer/simple-tokenizer-tests.factor
factor: Retrying on the unit tests. Also normalize some syntax with FUNCTION:.
[factor.git] / basis / simple-tokenizer / simple-tokenizer-tests.factor
1 IN: simple-tokenizer.tests
2 USING: simple-tokenizer tools.test ;
3
4 [ "" tokenize ] must-fail
5 [ "   " tokenize ] must-fail
6 { V{ "a" } } [ "a" tokenize ] unit-test
7 { V{ "abc" } } [ "abc" tokenize ] unit-test
8 { V{ "abc" } } [ "abc   " tokenize ] unit-test
9 { V{ "abc" } } [ "   abc" tokenize ] unit-test
10 { V{ "abc" "def" } } [ "abc def" tokenize ] unit-test
11 { V{ "abc def" } } [ "abc\\ def" tokenize ] unit-test
12 { V{ "abc\\" "def" } } [ "abc\\\\ def" tokenize ] unit-test
13 { V{ "abc\\ def" } } [ "\"abc\\\\ def\"" tokenize ] unit-test
14 { V{ "abc\\ def" } } [ "  \"abc\\\\ def\"" tokenize ] unit-test
15 { V{ "abc\\ def" "hey" } } [ "\"abc\\\\ def\" hey" tokenize ] unit-test
16 { V{ "abc def" "hey" } } [ "\"abc def\" \"hey\"" tokenize ] unit-test
17 [ "\"abc def\" \"hey" tokenize ] must-fail
18 [ "\"abc def" tokenize ] must-fail
19 { V{ "abc def" "h\"ey" } } [ "\"abc def\" \"h\\\"ey\"  " tokenize ] unit-test
20
21 {
22     V{
23         "Hello world.app/Contents/MacOS/hello-ui"
24         "-i=boot.macosx-ppc.image"
25         "-include= math compiler ui"
26         "-deploy-vocab=hello-ui"
27         "-output-image=Hello world.app/Contents/Resources/hello-ui.image"
28         "-no-stack-traces"
29         "-no-user-init"
30     }
31 } [
32     "\"Hello world.app/Contents/MacOS/hello-ui\" -i=boot.macosx-ppc.image \"-include= math compiler ui\" -deploy-vocab=hello-ui \"-output-image=Hello world.app/Contents/Resources/hello-ui.image\" -no-stack-traces -no-user-init" tokenize
33 ] unit-test
34
35 { V{ "ls" "-l" } } [ "ls -l" tokenize ] unit-test
36 { V{ "ls" "-l" } } [ "ls -l\n" tokenize ] unit-test
37 { V{ "ls" "-l" } } [ "\nls -l" tokenize ] unit-test
38 { V{ "ls" "-l" } } [ "\nls -l\n" tokenize ] unit-test