core/tsrc/fshell-unicode-test.script
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 #!fshell
       
     2 # fshell-unicode-test.script
       
     3 # 
       
     4 # Copyright (c) 2010 Accenture. All rights reserved.
       
     5 # This component and the accompanying materials are made available
       
     6 # under the terms of the "Eclipse Public License v1.0"
       
     7 # which accompanies this distribution, and is available
       
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 # 
       
    10 # Initial Contributors:
       
    11 # Accenture - Initial contribution
       
    12 #
       
    13 
       
    14 # Note this file is UTF-8!
       
    15 
       
    16 # Assume fshell-basic-test is working and this Error definition doesn't need testing
       
    17 var KEEP_GOING not-defined && export Error 'fshell -e "echo ^"Test failed, env is:^" && env && error"'
       
    18 var KEEP_GOING defined && export Error 'error -39 "Test failure in $SCRIPT_NAME at line $SCRIPT_LINE"'
       
    19 
       
    20 export TEST_STRING "EAcute:^u00E9 Beta:^u03b2 Smiley:^u263a"
       
    21 echo -n EAcute:é Beta:β Smiley:☺ | export -s RESULT
       
    22 
       
    23 # Check symmetric properties - I don't imagine these will ever fail unless variable expansion is really broken
       
    24 var TEST_STRING == "$TEST_STRING" || $Error
       
    25 var RESULT == "$RESULT" || $Error
       
    26 
       
    27 var RESULT == "$TEST_STRING" || $Error
       
    28 # And vice-versa
       
    29 var TEST_STRING == "$RESULT" || $Error
       
    30 
       
    31 echo "$TEST_STRING" > unicodetest.txt # This will output in UTF-8
       
    32 
       
    33 cat --encoding ltk-utf-8 unicodetest.txt | export -s CATRESULT
       
    34 var CATRESULT == "$TEST_STRING^r^n" || $Error
       
    35 
       
    36 export -s REDIRRESULT < unicodetest.txt
       
    37 var REDIRRESULT == "$TEST_STRING^r^n" || $Error
       
    38 
       
    39 rm unicodetest.txt