]> gitweb.factorcode.org Git - factor.git/blob - core/strings/parser/parser-tests.factor
82fd5aa504922d2cf4216b5e133bc55c530b5f05
[factor.git] / core / strings / parser / parser-tests.factor
1 USING: accessors eval strings.parser strings.parser.private
2 tools.test ;
3 IN: strings.parser.tests
4
5 [ "Hello\n\rworld" ] [ "Hello\\n\\rworld" unescape-string ] unit-test
6
7 [ "Hello\n\rworld" ] [ "Hello\n\rworld" ] unit-test
8 [ "Hello\n\rworld" ] [ """Hello\n\rworld""" ] unit-test
9 [ "Hello\n\rworld\n" ] [ "Hello\n\rworld
10 " ] unit-test
11 [ "Hello\n\rworld" "hi" ] [ "Hello\n\rworld" "hi" ] unit-test
12 [ "Hello\n\rworld" "hi" ] [ """Hello\n\rworld""" """hi""" ] unit-test
13 [ "Hello\n\rworld\n" "hi" ] [ """Hello\n\rworld
14 """ """hi""" ] unit-test
15 [ "Hello\n\rworld\"" "hi" ] [ """Hello\n\rworld\"""" """hi""" ] unit-test
16
17 [
18     "\"\"\"Hello\n\rworld\\\n\"\"\"" eval( -- obj )
19 ] [
20     error>> escaped-char-expected?
21 ] must-fail-with
22
23 [
24     " \" abc \" "
25 ] [
26     "\"\"\" \" abc \" \"\"\"" eval( -- string )
27 ] unit-test
28
29 [
30     "\"abc\""
31 ] [
32     "\"\"\"\"abc\"\"\"\"" eval( -- string )
33 ] unit-test
34
35
36 [ "\"\\" ] [ "\"\\" ] unit-test
37
38 [ "\e" ] [ "\u00001b" ] unit-test
39 [ "\e" ] [ "\x1b" ] unit-test