"Fossies" - the Fresh Open Source Software Archive

Member "js-beautify-1.14.0/python/jsbeautifier/tests/shell-test.sh" (14 Jun 2021, 19107 Bytes) of package /linux/www/js-beautify-1.14.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "shell-test.sh": 1.13.13_vs_1.14.0.

    1 #!/usr/bin/env bash
    2 
    3 REL_SCRIPT_DIR="`dirname \"$0\"`"
    4 SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`"
    5 PROJECT_DIR="`( cd \"$SCRIPT_DIR/../../..\" && pwd )`"
    6 
    7 case "$OSTYPE" in
    8     darwin*) PLATFORM="OSX" ;;
    9     linux*)  PLATFORM="LINUX" ;;
   10     bsd*)    PLATFORM="BSD" ;;
   11     *)       PLATFORM="UNKNOWN" ;;
   12 esac
   13 
   14 
   15 test_cli_common()
   16 {
   17     echo ----------------------------------------
   18     echo Testing common cli behavior...
   19     CLI_SCRIPT_NAME=${1:?missing_param}
   20     CLI_SCRIPT=${2:-$SCRIPT_DIR/../../$CLI_SCRIPT_NAME}
   21     echo Script: $CLI_SCRIPT
   22 
   23     # should find the minimal help output
   24     $CLI_SCRIPT 2>&1 < /dev/null | grep -q "Must pipe input or define at least one file\." || {
   25         $CLI_SCRIPT 2>&1 < /dev/null
   26         echo "[$CLI_SCRIPT_NAME] Output should be help message."
   27         exit 1
   28     }
   29 
   30     # unicode error - only happens in python
   31     # Note: different exceptions are thrown on different platforms.
   32     if [[ "$PLATFORM" == "OSX" || "$PLATFORM" == "BSD" || "$PLATFORM" == "LINUX" ]]; then
   33         $CLI_SCRIPT ../test/resources/unicode-error.js 2>&1 | grep -q "Error while decoding input or encoding output:" || {
   34             $CLI_SCRIPT ../test/resources/unicode-error.js 2>&1
   35             echo "[$CLI_SCRIPT_NAME] Output should be unicode error message."
   36             exit 1
   37         }
   38     fi
   39 
   40     $CLI_SCRIPT 2> /dev/null < /dev/null && {
   41         echo "[$CLI_SCRIPT_NAME (with no parameters)] Return code should be error."
   42         exit 1
   43     }
   44 
   45     $CLI_SCRIPT -Z 2> /dev/null && {
   46         echo "[$CLI_SCRIPT_NAME -Z] Return code for invalid parameter should be error."
   47         exit 1
   48     }
   49 
   50     $CLI_SCRIPT -h > /dev/null || {
   51         echo "[$CLI_SCRIPT_NAME -h] Return code should be success."
   52         exit 1
   53     }
   54 
   55     $CLI_SCRIPT -v > /dev/null || {
   56         echo "[$CLI_SCRIPT_NAME -v] Return code should be success."
   57         exit 1
   58     }
   59 
   60     MISSING_FILE="$SCRIPT_DIR/../../../js/bin/missing_file"
   61     MISSING_FILE_MESSAGE="No such file or directory"
   62     $CLI_SCRIPT $MISSING_FILE 2> /dev/null && {
   63         echo "[$CLI_SCRIPT_NAME $MISSING_FILE] Return code should be error."
   64         exit 1
   65     }
   66 
   67     $CLI_SCRIPT $MISSING_FILE 2>&1 | grep -q "$MISSING_FILE_MESSAGE" || {
   68         echo "[$CLI_SCRIPT_NAME $MISSING_FILE] Stderr should have useful message."
   69         exit 1
   70     }
   71 
   72     if [ "`$CLI_SCRIPT $MISSING_FILE 2> /dev/null`" != "" ]; then
   73         echo "[$CLI_SCRIPT_NAME $MISSING_FILE] Stdout should have no text."
   74         exit 1
   75     fi
   76 }
   77 
   78 setup_temp()
   79 {
   80     mkdir -p target
   81     TEST_TEMP=$PWD/`mktemp -d target/test_temp_XXXX`
   82     echo Created $TEST_TEMP...
   83 }
   84 
   85 cleanup()
   86 {
   87     rm -rf $TEST_TEMP && echo Removed $TEST_TEMP...
   88     test -z $1 || exit $1
   89 }
   90 
   91 test_cli_js_beautify()
   92 {
   93     echo ----------------------------------------
   94     echo Testing js-beautify cli behavior...
   95     CLI_SCRIPT=${1:-$SCRIPT_DIR/../../js-beautify}
   96 
   97     $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js > /dev/null || {
   98         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected succeed."
   99         exit 1
  100     }
  101 
  102     $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/css-beautify.js > /dev/null || {
  103         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/css-beautify.js was expected succeed."
  104         exit 1
  105     }
  106 
  107     setup_temp
  108     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-file.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-file.js || {
  109         $CLI_SCRIPT -o $TEST_TEMP/js-beautify-file.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-file.js | cat -t -e
  110         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
  111         cleanup 1
  112     }
  113 
  114     cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT -o $TEST_TEMP/js-beautify-pipe.js - && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-pipe.js || {
  115         cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT -o $TEST_TEMP/js-beautify-pipe.js - && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify-pipe.js | cat -t -e
  116         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js should have been created in $TEST_TEMP/js-beautify-pipe.js."
  117         cleanup 1
  118     }
  119 
  120     $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
  121         $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
  122         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
  123         cleanup 1
  124     }
  125 
  126     cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
  127         $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
  128         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
  129         cleanup 1
  130     }
  131 
  132     cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT - | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
  133         $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
  134         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
  135         cleanup 1
  136     }
  137 
  138     cat $SCRIPT_DIR/../../../js/bin/js-beautify.js | $CLI_SCRIPT -f - | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - || {
  139         $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/js-beautify.js | diff $SCRIPT_DIR/../../../js/bin/js-beautify.js - | cat -t -e
  140         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js was expected to be unchanged."
  141         cleanup 1
  142     }
  143 
  144     $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify.js || {
  145     $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $SCRIPT_DIR/../../../js/bin/js-beautify.js && diff $SCRIPT_DIR/../../../js/bin/js-beautify.js $TEST_TEMP/js-beautify.js | cat -t -e
  146         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/js-beautify.js should have been created in $TEST_TEMP/js-beautify.js."
  147         cleanup 1
  148     }
  149 
  150 
  151     # ensure new line settings work
  152     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-n.js -e '\n' $SCRIPT_DIR/../../../js/bin/js-beautify.js
  153     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-rn.js -e '\r\n' $TEST_TEMP/js-beautify-n.js
  154 
  155     # regression check #1925, short option failed due to string search instead of tuple
  156     # before fix -n would match inside "--space-after**-n**amed-function"
  157     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-eof.js -n -f $TEST_TEMP/js-beautify-n.js
  158     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-eof2.js --end-with-newline -f $TEST_TEMP/js-beautify-n.js
  159     diff -q $TEST_TEMP/js-beautify-eof.js $TEST_TEMP/js-beautify-eof2.js || {
  160         diff $TEST_TEMP/js-beautify-eof.js $TEST_TEMP/js-beautify-eof2.js | cat -t -e
  161         echo "js-beautify output for $TEST_TEMP/js-beautify-eof.js and $TEST_TEMP/js-beautify-eof2.js was expected to be the same."
  162         cleanup 1
  163     }
  164 
  165     # ensure eol processed correctly
  166     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-n-dash.js --indent-size 2 --eol '\n' $TEST_TEMP/js-beautify-n.js
  167     $CLI_SCRIPT -o $TEST_TEMP/js-beautify-rn-dash.js --indent-size 2 --eol '\r\n' $TEST_TEMP/js-beautify-n.js
  168     diff -q $TEST_TEMP/js-beautify-n-dash.js $TEST_TEMP/js-beautify-rn-dash.js && {
  169         diff $TEST_TEMP/js-beautify-n-dash.js $TEST_TEMP/js-beautify-rn-dash.js | cat -t -e
  170         echo "js-beautify output for $TEST_TEMP/js-beautify-n-dash.js and $TEST_TEMP/js-beautify-rn-dash.js was expected to be different."
  171         cleanup 1
  172     }
  173 
  174     diff -q $TEST_TEMP/js-beautify-n.js $TEST_TEMP/js-beautify-rn.js && {
  175         diff $TEST_TEMP/js-beautify-n.js $TEST_TEMP/js-beautify-rn.js | cat -t -e
  176         echo "js-beautify output for $TEST_TEMP/js-beautify-n.js and $TEST_TEMP/js-beautify-rn.js was expected to be different."
  177         cleanup 1
  178     }
  179 
  180     $CLI_SCRIPT $TEST_TEMP/js-beautify-n.js | diff -q $TEST_TEMP/js-beautify-n.js - || {
  181         echo "js-beautify output for $TEST_TEMP/js-beautify-n.js was expected to be unchanged."
  182         cleanup 1
  183     }
  184 
  185     $CLI_SCRIPT -e 'auto' $TEST_TEMP/js-beautify-rn.js | diff -q $TEST_TEMP/js-beautify-rn.js - || {
  186         echo "js-beautify output for $TEST_TEMP/js-beautify-rn.js was expected to be unchanged."
  187         cleanup 1
  188     }
  189 
  190     # Glob related tests
  191     cp -r $PROJECT_DIR/js/src  $TEST_TEMP/
  192     FILE_RCOUNT=$(find $PROJECT_DIR/js/src -name 't*.js' | grep -c .)
  193     FILE_COUNT=$(ls $PROJECT_DIR/js/src/*.js | grep -c .)
  194 
  195     $CLI_SCRIPT '*/*/missing_file' > /dev/null || {
  196         echo "[$CLI_SCRIPT_NAME $MISSING_FILE_GLOB] Return code should be success for globs."
  197         exit 1
  198     }
  199 
  200 
  201     if [ "$FILE_COUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT 'src/*.js' | grep -c .)" ]; then
  202         echo "js-beautify output for 'src/*.js' was expected have $FILE_COUNT files."
  203         echo $(cd $TEST_TEMP && $CLI_SCRIPT 'src/*.js')
  204         cleanup 1
  205     fi
  206 
  207     if [ "$FILE_COUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/*.js' | grep -c .)" ]; then
  208         echo "js-beautify output for 'src/*.js' was expected have $FILE_COUNT files."
  209         echo $(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/*.js')
  210         cleanup 1
  211     fi
  212 
  213     if [ "$FILE_COUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/??dex.js' | grep -c .)" ]; then
  214         echo "js-beautify output for --file 'src/cl?.js' --file 'src/??dex.js' was expected have $FILE_COUNT files."
  215         echo $(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/??dex.js')
  216         cleanup 1
  217     fi
  218 
  219     if [ "1" != "$(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/c??.js' 'src/cli.js'  | grep -c .)" ]; then
  220         echo "js-beautify output for --file 'src/cl?.js' --file 'src/cl?.js' was expected have 1 file."
  221         echo $(cd $TEST_TEMP && $CLI_SCRIPT --file 'src/cl?.js' --file 'src/c??.js' 'src/cli.js')
  222         cleanup 1
  223     fi
  224 
  225     # recursive wildcard not supported in python 3.4 or less
  226     # only run this test if the script doesn't report failure.
  227     $CLI_SCRIPT 'src/**/t*.js' && {
  228         if [ "$FILE_RCOUNT" != "$(cd $TEST_TEMP && $CLI_SCRIPT 'src/**/t*.js' | grep -c .)" ]; then
  229             echo "js-beautify output for 'src/**/t*.js' was expected have $FILE_RCOUNT files."
  230             echo $(cd $TEST_TEMP && $CLI_SCRIPT 'src/**/t*.js')
  231             cleanup 1
  232         fi
  233     }
  234 
  235     # EditorConfig related tests
  236     cp -r ../js/test/resources/editorconfig $TEST_TEMP/
  237     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
  238     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/example-ec.js --indent-size 2 -e '\n' $TEST_TEMP/editorconfig/example-base.js
  239 
  240     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/cr/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
  241     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/cr/example-ec.js --indent-size 2 -e '\r' $TEST_TEMP/editorconfig/example-base.js
  242 
  243     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/crlf/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
  244     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/crlf/example-ec.js --indent-size 2 -e '\r\n' $TEST_TEMP/editorconfig/example-base.js
  245 
  246     $CLI_SCRIPT -o $TEST_TEMP/editorconfig/error/example.js --end-with-newline --indent-size 4 -e '\n' $TEST_TEMP/editorconfig/example-base.js
  247 
  248     pushd $TEST_TEMP/editorconfig
  249 
  250     cd $TEST_TEMP/editorconfig/error
  251     $CLI_SCRIPT --editorconfig $TEST_TEMP/js-beautify-n.js \
  252     > /dev/null || {
  253         echo "Invalid editorconfig file should not report error (consistent with the EditorConfig)."
  254         cleanup 1
  255     }
  256 
  257     $CLI_SCRIPT --editorconfig example.js \
  258     > /dev/null || {
  259         echo "Invalid editorconfig file should not report error (consistent with the EditorConfig)."
  260         cleanup 1
  261     }
  262 
  263     # TODO: EditorConfig setting should NOT overide cli setting, but that is
  264     # the current by-design behavior, due to code limitations.
  265 
  266     # file input scenario
  267     SCENARIO=a
  268     cd $TEST_TEMP/editorconfig || exit 1
  269     $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
  270     && diff -q example-${SCENARIO}.js example-ec.js || {
  271         echo "EditorConfig setting should overide cli setting."
  272         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  273         cleanup 1
  274     }
  275 
  276     cd $TEST_TEMP/editorconfig/crlf || exit 1
  277     $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
  278     && diff -q example-${SCENARIO}.js example-ec.js || {
  279         echo "EditorConfig setting should overide cli setting."
  280         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  281         cleanup 1
  282     }
  283 
  284     cd $TEST_TEMP/editorconfig/cr || exit 1
  285     $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
  286     && diff -q example-${SCENARIO}.js example-ec.js || {
  287         echo "EditorConfig setting should overide cli setting."
  288         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  289         cleanup 1
  290     }
  291 
  292     # stdin input to stdout scenario
  293     SCENARIO=b
  294     cd $TEST_TEMP/editorconfig || exit 1
  295     echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
  296     cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
  297     && diff -q example-${SCENARIO}.js example-ec.js || {
  298         echo "EditorConfig setting should overide cli setting."
  299         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  300         cleanup 1
  301     }
  302 
  303     cd $TEST_TEMP/editorconfig/crlf || exit 1
  304     echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
  305     cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
  306     && diff -q example-${SCENARIO}.js example-ec.js || {
  307         echo "EditorConfig setting should overide cli setting."
  308         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  309         cleanup 1
  310     }
  311 
  312     cd $TEST_TEMP/editorconfig/cr || exit 1
  313     echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
  314     cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
  315     && diff -q example-${SCENARIO}.js example-ec.js || {
  316         echo "EditorConfig setting should overide cli setting."
  317         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  318         cleanup 1
  319     }
  320 
  321 
  322     # stdin input to file scenario
  323     SCENARIO=c
  324     cd $TEST_TEMP/editorconfig || exit 1
  325     echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js"
  326     cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
  327     && diff -q example-${SCENARIO}.js example-ec.js || {
  328         echo "EditorConfig setting should overide cli setting."
  329         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  330         cleanup 1
  331     }
  332 
  333     cd $TEST_TEMP/editorconfig/crlf || exit 1
  334     cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
  335     && diff -q example-${SCENARIO}.js example-ec.js || {
  336         echo "EditorConfig setting should overide cli setting."
  337         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  338         cleanup 1
  339     }
  340 
  341     cd $TEST_TEMP/editorconfig/cr || exit 1
  342     cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
  343     && diff -q example-${SCENARIO}.js example-ec.js || {
  344         echo "EditorConfig setting should overide cli setting."
  345         diff example-${SCENARIO}.js example-ec.js | cat -t -e
  346         cleanup 1
  347     }
  348 
  349     popd
  350     # End EditorConfig
  351 
  352     # ensure unchanged files are not overwritten
  353     $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $SCRIPT_DIR/../../../js/bin/js-beautify.js
  354     cp -p $TEST_TEMP/js-beautify.js $TEST_TEMP/js-beautify-old.js
  355     touch $TEST_TEMP/js-beautify.js
  356     sleep 2
  357     touch $TEST_TEMP/js-beautify-old.js
  358     $CLI_SCRIPT -r $TEST_TEMP/js-beautify.js && test $TEST_TEMP/js-beautify.js -nt $TEST_TEMP/js-beautify-old.js && {
  359         echo "js-beautify should not replace unchanged file $TEST_TEMP/js-beautify.js when using -r"
  360         cleanup 1
  361     }
  362 
  363     $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $TEST_TEMP/js-beautify.js && test $TEST_TEMP/js-beautify.js -nt $TEST_TEMP/js-beautify-old.js && {
  364         echo "js-beautify should not replace unchanged file $TEST_TEMP/js-beautify.js when using -o and same file name"
  365         cleanup 1
  366     }
  367 
  368     $CLI_SCRIPT -o $TEST_TEMP/js-beautify.js $TEST_TEMP/js-beautify-old.js && test $TEST_TEMP/js-beautify.js -nt $TEST_TEMP/js-beautify-old.js && {
  369         echo "js-beautify should not replace unchanged file $TEST_TEMP/js-beautify.js when using -o and different file name"
  370         cleanup 1
  371     }
  372 
  373     $CLI_SCRIPT $SCRIPT_DIR/../../../js/bin/css-beautify.js | diff -q $SCRIPT_DIR/../../../js/bin/css-beautify.js - && {
  374         echo "js-beautify output for $SCRIPT_DIR/../../../js/bin/css-beautify.js was expected to be different."
  375         cleanup 1
  376     }
  377 
  378     #meta-parameter brace_style
  379     cp ../js/test/resources/example1.js $TEST_TEMP/example.js
  380     $CLI_SCRIPT --brace-style=invalid $TEST_TEMP/example.js > /dev/null && {
  381         echo "[$CLI_SCRIPT_NAME --brace-style=invalid $TEST_TEMP/example.js] Return code for invalid brace_style meta-parameter should be error."
  382         cleanup 1
  383     }
  384     $CLI_SCRIPT --brace-style='expand,preserve-inline,invalid' $TEST_TEMP/example.js > /dev/null && {
  385         echo "[$CLI_SCRIPT_NAME --brace-style=expand,preserve-inline,invalid $TEST_TEMP/example.js] Return code for invalid brace_style meta-parameter should be error."
  386         cleanup 1
  387     }
  388     $CLI_SCRIPT --brace-style=preserve-inline $TEST_TEMP/example.js > /dev/null || {
  389         echo "[$CLI_SCRIPT_NAME --brace-style=preserve-inline $TEST_TEMP/example.js] Return code for only one part of valid brace_style meta-parameter should be success (uses default where it can)."
  390         cleanup 1
  391     }
  392 
  393     cleanup
  394 }
  395 
  396 main() {
  397 
  398     test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-dev css-beautify"
  399     test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-rel css-beautify"
  400 
  401     test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-dev js-beautify"
  402     test_cli_common js-beautify "$SCRIPT_DIR/../../../tools/python-rel js-beautify"
  403 
  404     test_cli_js_beautify "$SCRIPT_DIR/../../../tools/python-dev js-beautify"
  405 
  406     echo ----------------------------------------
  407     echo $0 - PASSED.
  408     echo ----------------------------------------
  409 }
  410 
  411 (main $*)