[gjs] maintenance: modernize shell scripts



commit 67a0d7e955460dbd1cd28c7c7fa45ddc3edcfea1
Author: Claudio André <claudioandre br gmail com>
Date:   Wed Apr 26 17:29:56 2017 -0300

    maintenance: modernize shell scripts
    
    It is possible to use a static analysis tool to improve all scripts robustness and safety.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781806

 installed-tests/scripts/testCommandLine.sh |   24 ++++++++++++------------
 installed-tests/scripts/testWarnings.sh    |    6 +++---
 2 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/installed-tests/scripts/testCommandLine.sh b/installed-tests/scripts/testCommandLine.sh
index c51a302..2e0d55e 100755
--- a/installed-tests/scripts/testCommandLine.sh
+++ b/installed-tests/scripts/testCommandLine.sh
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
-    gjs="$TOP_BUILDDIR"/gjs-console
+    gjs="$TOP_BUILDDIR/gjs-console"
 else
-    gjs=gjs-console
+    gjs="gjs-console"
 fi
 
 # This JS script should exit immediately with code 42. If that is not working,
@@ -31,7 +31,7 @@ total=0
 
 report () {
     exit_code=$?
-    total=`expr $total + 1`
+    total=$((total + 1))
     if test $exit_code -eq 0; then
         echo "ok $total - $1"
     else
@@ -41,7 +41,7 @@ report () {
 
 report_xfail () {
     exit_code=$?
-    total=`expr $total + 1`
+    total=$((total + 1))
     if test $exit_code -ne 0; then
         echo "ok $total - $1"
     else
@@ -65,39 +65,39 @@ report "System.exit() should still exit across an FFI boundary"
 # gjs --help prints GJS help
 "$gjs" --help >/dev/null
 report "--help should succeed"
-test -n "`"$gjs" --help`"
+test -n "$("$gjs" --help)"
 report "--help should print something"
 
 # print GJS help even if it's not the first argument
 "$gjs" -I . --help >/dev/null
 report "should succeed when --help is not first arg"
-test -n "`"$gjs" -I . --help`"
+test -n "$("$gjs" -I . --help)"
 report "should print something when --help is not first arg"
 
 # --help before a script file name prints GJS help
 "$gjs" --help help.js >/dev/null
 report "--help should succeed before a script file"
-test -n "`"$gjs" --help help.js`"
+test -n "$("$gjs" --help help.js)"
 report "--help should print something before a script file"
 
 # --help before a -c argument prints GJS help
 script='imports.system.exit(1)'
 "$gjs" --help -c "$script" >/dev/null
 report "--help should succeed before -c"
-test -n "`"$gjs" --help -c "$script"`"
+test -n "$("$gjs" --help -c "$script")"
 report "--help should print something before -c"
 
 # --help after a script file name is passed to the script
 "$gjs" -I sentinel help.js --help
 report "--help after script file should be passed to script"
-test -z "`"$gjs" -I sentinel help.js --help`"
+test -z "$("$gjs" -I sentinel help.js --help)"
 report "--help after script file should not print anything"
 
 # --help after a -c argument is passed to the script
 script='if(ARGV[0] !== "--help") imports.system.exit(1)'
 "$gjs" -c "$script" --help
 report "--help after -c should be passed to script"
-test -z "`"$gjs" -c "$script" --help`"
+test -z "$("$gjs" -c "$script" --help)"
 report "--help after -c should not print anything"
 
 # -I after a program is not consumed by GJS
@@ -116,14 +116,14 @@ rm -f foo/coverage.lcov
 # --version works
 "$gjs" --version >/dev/null
 report "--version should work"
-test -n "`"$gjs" --version`"
+test -n "$("$gjs" --version)"
 report "--version should print something"
 
 # --version after a script goes to the script
 script='if(ARGV[0] !== "--version") imports.system.exit(1)'
 "$gjs" -c "$script" --version
 report "--version after -c should be passed to script"
-test -z "`"$gjs" -c "$script" --version`"
+test -z "$("$gjs" -c "$script" --version)"
 report "--version after -c should not print anything"
 
 rm -f exit.js help.js
diff --git a/installed-tests/scripts/testWarnings.sh b/installed-tests/scripts/testWarnings.sh
index f95dd9a..ebf3143 100755
--- a/installed-tests/scripts/testWarnings.sh
+++ b/installed-tests/scripts/testWarnings.sh
@@ -1,16 +1,16 @@
 #!/bin/sh
 
 if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
-    gjs="$TOP_BUILDDIR"/gjs-console
+    gjs="$TOP_BUILDDIR/gjs-console"
 else
-    gjs=gjs-console
+    gjs="gjs-console"
 fi
 
 total=0
 
 report () {
     exit_code=$?
-    total=`expr $total + 1`
+    total=$((total + 1))
     if test $exit_code -eq 0; then
         echo "ok $total - $1"
     else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]