]> gitweb.factorcode.org Git - factor.git/blob - basis/simple-tokenizer/simple-tokenizer-tests.factor
io.pathnames: go with / on windows for canonicalize-path
[factor.git] / basis / simple-tokenizer / simple-tokenizer-tests.factor
1 USING: simple-tokenizer tools.test ;
2
3 [ "" tokenize ] must-fail
4 [ "   " tokenize ] must-fail
5 { V{ "a" } } [ "a" tokenize ] unit-test
6 { V{ "abc" } } [ "abc" tokenize ] unit-test
7 { V{ "abc" } } [ "abc   " tokenize ] unit-test
8 { V{ "abc" } } [ "   abc" tokenize ] unit-test
9 { V{ "abc" "def" } } [ "abc def" 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" "hey" } } [ "\"abc\\\\ def\" hey" tokenize ] unit-test
15 { V{ "abc def" "hey" } } [ "\"abc def\" \"hey\"" tokenize ] unit-test
16 [ "\"abc def\" \"hey" tokenize ] must-fail
17 [ "\"abc def" tokenize ] must-fail
18 { V{ "abc def" "h\"ey" } } [ "\"abc def\" \"h\\\"ey\"  " tokenize ] unit-test
19
20 {
21     V{
22         "Hello world.app/Contents/MacOS/hello-ui"
23         "-i=boot.macosx-ppc.image"
24         "-include= math compiler ui"
25         "-deploy-vocab=hello-ui"
26         "-output-image=Hello world.app/Contents/Resources/hello-ui.image"
27         "-no-stack-traces"
28         "-no-user-init"
29     }
30 } [
31     "\"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
32 ] unit-test
33
34 { V{ "ls" "-l" } } [ "ls -l" tokenize ] unit-test
35 { V{ "ls" "-l" } } [ "ls -l\n" tokenize ] unit-test
36 { V{ "ls" "-l" } } [ "\nls -l" tokenize ] unit-test
37 { V{ "ls" "-l" } } [ "\nls -l\n" tokenize ] unit-test