Clean up the shell smoke tests

This commit is contained in:
Liam Newman 2013-04-14 15:24:38 -07:00
parent e91a12e551
commit 9355d6a0a1

View File

@ -7,32 +7,33 @@ test_cli_common()
{
echo ----------------------------------------
echo Testing common cli behavior...
CLI_SCRIPT=${1:?missing_param}
CLI_SCRIPT_NAME=${1:?missing_param}.js
CLI_SCRIPT=$SCRIPT_DIR/../bin/$CLI_SCRIPT_NAME
echo Script: $CLI_SCRIPT
# should find the minimal help output
$SCRIPT_DIR/../bin/$CLI_SCRIPT.js 2>&1 | grep -q "Must define at least one file\." || {
echo "[$CLI_SCRIPT.js] Output should be help message."
$CLI_SCRIPT 2>&1 | grep -q "Must define at least one file\." || {
echo "[$CLI_SCRIPT_NAME] Output should be help message."
exit 1
}
$SCRIPT_DIR/../bin/$CLI_SCRIPT.js 2> /dev/null && {
echo "[$CLI_SCRIPT.js (with no parameters)] Return code should be error."
$CLI_SCRIPT 2> /dev/null && {
echo "[$CLI_SCRIPT_NAME (with no parameters)] Return code should be error."
exit 1
}
$SCRIPT_DIR/../bin/$CLI_SCRIPT.js -invalidParameter 2> /dev/null && {
echo "[$CLI_SCRIPT.js -invalidParameter] Return code should be error."
$CLI_SCRIPT -invalidParameter 2> /dev/null && {
echo "[$CLI_SCRIPT_NAME -invalidParameter] Return code should be error."
exit 1
}
$SCRIPT_DIR/../bin/$CLI_SCRIPT.js -h > /dev/null || {
echo "[$CLI_SCRIPT.js -h] Return code should be success."
$CLI_SCRIPT -h > /dev/null || {
echo "[$CLI_SCRIPT_NAME -h] Return code should be success."
exit 1
}
$SCRIPT_DIR/../bin/$CLI_SCRIPT.js -v > /dev/null || {
echo "[$CLI_SCRIPT.js -v] Return code should be success."
$CLI_SCRIPT -v > /dev/null || {
echo "[$CLI_SCRIPT_NAME -v] Return code should be success."
exit 1
}
@ -42,22 +43,24 @@ test_cli_js_beautify()
{
echo ----------------------------------------
echo Testing js-beautify cli behavior...
$SCRIPT_DIR/../bin/js-beautify.js $SCRIPT_DIR/../bin/js-beautify.js > /dev/null || {
CLI_SCRIPT= $SCRIPT_DIR/../bin/js-beautify.js
$CLI_SCRIPT $SCRIPT_DIR/../bin/js-beautify.js > /dev/null || {
echo "js-beautify output for $SCRIPT_DIR/../bin/js-beautify.js was expected succeed."
exit 1
}
$SCRIPT_DIR/../bin/js-beautify.js $SCRIPT_DIR/../bin/css-beautify.js > /dev/null || {
$CLI_SCRIPT $SCRIPT_DIR/../bin/css-beautify.js > /dev/null || {
echo "js-beautify output for $SCRIPT_DIR/../bin/css-beautify.js was expected succeed."
exit 1
}
$SCRIPT_DIR/../bin/js-beautify.js $SCRIPT_DIR/../bin/js-beautify.js | diff $SCRIPT_DIR/../bin/js-beautify.js - || {
$CLI_SCRIPT $SCRIPT_DIR/../bin/js-beautify.js | diff $SCRIPT_DIR/../bin/js-beautify.js - || {
echo "js-beautify output for $SCRIPT_DIR/../bin/js-beautify.js was expected to be unchanged."
exit 1
}
$SCRIPT_DIR/../bin/js-beautify.js $SCRIPT_DIR/../bin/css-beautify.js | diff -q $SCRIPT_DIR/../bin/css-beautify.js - && {
$CLI_SCRIPT $SCRIPT_DIR/../bin/css-beautify.js | diff -q $SCRIPT_DIR/../bin/css-beautify.js - && {
echo "js-beautify output for $SCRIPT_DIR/../bin/css-beautify.js was expected to be different."
exit 1
}