[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    [PATCH] FIX: Syntax of shell and perl scripts and posix compliant
From:       Guillaume Sasdy <guillaume.sasdy () ensimag ! imag ! fr>
Date:       2012-05-31 18:27:04
Message-ID: 1338488824-3336-1-git-send-email-guillaume.sasdy () ensimag ! imag ! fr
[Download RAW message or body]

From: Simon Cathebras <simon.cathebras@ensimag.imag.fr>

t/test-gitmw.pl: no more '\n' in the append of wiki_editpage
t/test-gitmw-lib.sh: grep is now Posix compliant
t/test-gitmw-lib.sh: some "  " were misplaced
---
 t/test-gitmw-lib.sh | 17 ++++++++---------
 t/test-gitmw.pl     |  4 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/t/test-gitmw-lib.sh b/t/test-gitmw-lib.sh
index b89b45a..d7c7459 100755
--- a/t/test-gitmw-lib.sh
+++ b/t/test-gitmw-lib.sh
@@ -31,14 +31,14 @@ WIKI_PASSW="AdminPass"
 # Fetch a page <page_name> from the wiki and copy its content
 # into directory <dest_path>.
 wiki_getpage () {
-	../test-gitmw.pl "get_page" -p "$1" "$2"
+	../test-gitmw.pl get_page -p "$1" "$2"
 }
 
 # wiki_delete_page <page_name>
 #
 # Delete the page <page_name> on the wiki.
 wiki_delete_page () {
-	../test-gitmw.pl "delete_page" -p "$1"
+	../test-gitmw.pl delete_page -p "$1"
 }
 
 # wiki_edit_page <page_name> <page_content> <page_append>
@@ -47,7 +47,7 @@ wiki_delete_page () {
 # If <wiki_append> == true the content will be appended
 # If the page doesn't exist, it is created.
 wiki_editpage () {
-	../test-gitmw.pl "edit_page" -p "$1" "$2" "$3"
+	../test-gitmw.pl edit_page -p "$1" "$2" "$3"
 }
 
 # git_content <dir_1> <dir_2>
@@ -56,7 +56,7 @@ wiki_editpage () {
 # and exits with error 1 if they do not match. The program will
 # not look into .git in the process.
 git_content () {
-	result=$(diff -r -B -w --exclude=".git" "$1" "$2")
+	result=$(diff -r -b --exclude=".git" "$1" "$2")
 
 	if echo $result | grep -q ">" ; then
 		echo "test failed: files $1 and $2 do not match"
@@ -77,11 +77,11 @@ git_exist () {
 	fi
 }
 
-# wiki_page_content <file_name> <page_name> 
+# wiki_check_content <file_name> <page_name> 
 #
 # Compares the contents of the file <file_name> and the wiki page
 # <page_name> and exits with error 1 if they do not match.
-wiki_page_content () {
+wiki_check_content () {
 	wiki_getpage "$2" .
 
 	if test -f "$2".mw ; then
@@ -120,16 +120,15 @@ wiki_getallpagename () {
 # <dest_dir>.
 wiki_getallpage () {
 	wiki_getallpagename
-	mkdir $1
+	mkdir -p "$1"
 	while read -r line; do
 		wiki_getpage "$line" $1;
 	done < all.txt
-	#rm all.txt
 }
 
 fail()
 {
-    echo $1
+    echo "$1"
     exit 1
 }
 
diff --git a/t/test-gitmw.pl b/t/test-gitmw.pl
index e9c50f9..bf71485 100755
--- a/t/test-gitmw.pl
+++ b/t/test-gitmw.pl
@@ -9,7 +9,7 @@
 # License: GPL v2 or later
 
 # Usage:
-#       ./test-gitmw.pl <function> [argument]*
+#       ./test-gitmw.pl <command> [argument]*
 # Execute in terminal using the name of the function to call as first
 # parameter, and the function's arguments as following parameters
 #
@@ -111,7 +111,7 @@ sub wiki_editpage {
 
 	my $text = $wiki_content;
 	if (defined($previous_text)) {
-		$text="$previous_text\n\n$text";
+		$text="$previous_text$text";
 	}
 	$mw->edit( { action => 'edit', title => $wiki_page, text => "$text"} );
 }
-- 
1.7.10.2.568.g4c26a3a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic