mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-27 14:40:23 +00:00
Clean up the shell smoke tests
This commit is contained in:
parent
e91a12e551
commit
9355d6a0a1
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user