2016-04-04 18:13:46 -04:00
|
|
|
USING: accessors kernel eval strings.parser tools.test ;
|
2008-12-08 20:46:40 -05:00
|
|
|
|
2015-07-02 20:28:17 -04:00
|
|
|
{ "Hello\n\rworld" } [ "Hello\\n\\rworld" unescape-string ] unit-test
|
2009-09-19 04:55:05 -04:00
|
|
|
|
2015-07-02 20:28:17 -04:00
|
|
|
{ "Hello\n\rworld" } [ "Hello\n\rworld" ] unit-test
|
|
|
|
{ "Hello\n\rworld\n" } [ "Hello\n\rworld
|
2009-09-19 04:55:05 -04:00
|
|
|
" ] unit-test
|
2015-07-02 20:28:17 -04:00
|
|
|
{ "Hello\n\rworld" "hi" } [ "Hello\n\rworld" "hi" ] unit-test
|
2015-07-26 01:59:56 -04:00
|
|
|
{ "Hello\n\rworld" "hi" } [ "Hello\n\rworld" "hi" ] unit-test
|
|
|
|
{ "Hello\n\rworld\n" "hi" } [ "Hello\n\rworld
|
|
|
|
" "hi" ] unit-test
|
|
|
|
{ "Hello\n\rworld\"" "hi" } [ "Hello\n\rworld\"" "hi" ] unit-test
|
2009-09-20 15:18:19 -04:00
|
|
|
|
2015-08-17 22:49:12 -04:00
|
|
|
{ "foobarbaz" } [ "\"foo\\\nbar\\\r\nbaz\"" eval( -- obj ) ] unit-test
|
2009-09-20 22:50:17 -04:00
|
|
|
|
2015-08-17 22:49:12 -04:00
|
|
|
{ "\"abc\"" } [ "\"\\\"abc\\\"\"" eval( -- string ) ] unit-test
|
2016-04-04 18:13:46 -04:00
|
|
|
[ "\"" eval( -- string ) ] [ error>> "Unterminated string" = ] must-fail-with
|
|
|
|
[ "\"abc" eval( -- string ) ] [ error>> "Unterminated string" = ] must-fail-with
|
|
|
|
[ "\"abc\n\n" eval( -- string ) ] [ error>> "Unterminated string" = ] must-fail-with
|
2009-09-20 22:50:17 -04:00
|
|
|
|
2015-07-02 20:28:17 -04:00
|
|
|
{ "\"\\" } [ "\"\\" ] unit-test
|
2012-07-26 22:24:25 -04:00
|
|
|
|
2015-07-02 20:28:17 -04:00
|
|
|
{ "\e" } [ "\u00001b" ] unit-test
|
|
|
|
{ "\e" } [ "\x1b" ] unit-test
|