remote-mediawiki tests: change `[]` to `test`
Convert `[]` to `test` and break if-then into separate lines, both of which bring the style in line with Git's coding guidelines. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Sep 21, 2020 at 12:39 UTC
730ecc10c7069b1968e4c90b9450013546a510b3
1 file changed
+11
-6
contrib/mw-to-git/t/test-gitmw-lib.sh
+11
-6
@@ -65,7 +65,7 @@ test_check_precond () {
65
GIT_EXEC_PATH=$(cd "$(dirname "$0")" && cd "../.." && pwd)
66
PATH="$GIT_EXEC_PATH"'/bin-wrapper:'"$PATH"
67
68
- if [ ! -d "$WIKI_DIR_INST/$WIKI_DIR_NAME" ];
68
+ if ! test -d "$WIKI_DIR_INST/$WIKI_DIR_NAME"
69
then
70
skip_all='skipping gateway git-mw tests, no mediawiki found'
71
test_done
@@ -304,7 +304,8 @@ create_db () {
304
php "$FILES_FOLDER/$DB_INSTALL_SCRIPT" $(basename "$DB_FILE" .sqlite) \
305
"$WIKI_ADMIN" "$WIKI_PASSW" "$TMP" "$PORT"
306
307
- if [ ! -f "$TMP/$DB_FILE" ] ; then
307
+ if ! test -f "$TMP/$DB_FILE"
308
+ then
309
error "Can't create database file $TMP/$DB_FILE. Try to run ./install-wiki.sh delete first."
310
fi
311
@@ -325,7 +326,8 @@ wiki_install () {
326
# unpack and copy the files of MediaWiki
327
(
328
mkdir -p "$WIKI_DIR_INST/$WIKI_DIR_NAME"
328
- if [ ! -d "$WIKI_DIR_INST/$WIKI_DIR_NAME" ] ; then
329
+ if ! test -d "$WIKI_DIR_INST/$WIKI_DIR_NAME"
330
+ then
331
error "Folder $WIKI_DIR_INST/$WIKI_DIR_NAME doesn't exist.
332
Please create it and launch the script again."
333
fi
@@ -333,7 +335,8 @@ wiki_install () {
335
# Fetch MediaWiki's archive if not already present in the TMP directory
336
MW_FILENAME="mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
337
cd "$TMP"
336
- if [ ! -f $MW_FILENAME ] ; then
338
+ if ! test -f $MW_FILENAME
339
+ then
340
echo "Downloading $MW_VERSION_MAJOR.$MW_VERSION_MINOR sources ..."
341
wget "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/$MW_FILENAME" ||
342
error "Unable to download "\
@@ -359,7 +362,8 @@ wiki_install () {
362
# And modify parameters according to the ones set at the top
363
# of this script.
364
# Note that LocalSettings.php is never modified.
362
- if [ ! -f "$FILES_FOLDER/LocalSettings.php" ] ; then
365
+ if ! test -f "$FILES_FOLDER/LocalSettings.php"
366
+ then
367
error "Can't find $FILES_FOLDER/LocalSettings.php " \
368
"in the current folder. "\
369
"Please run the script inside its folder."
@@ -401,7 +405,8 @@ wiki_install () {
405
# Warning: This function must be called only in a subdirectory of t/ directory
406
wiki_reset () {
407
# Copy initial database of the wiki
404
- if [ ! -f "../$FILES_FOLDER/$DB_FILE" ] ; then
408
+ if ! test -f "../$FILES_FOLDER/$DB_FILE"
409
+ then
410
error "Can't find ../$FILES_FOLDER/$DB_FILE in the current folder."
411
fi
412
cp "../$FILES_FOLDER/$DB_FILE" "$TMP" ||