git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] FIX: Syntax of shell and perl scripts and posix compliant

From
GSGuillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
Date
May 31, 2012, 18:13 UTC
Message-ID
<1338487992-305-2-git-send-email-guillaume.sasdy@ensimag.imag.fr>
In-Reply-To
<1338487992-305-1-git-send-email-guillaume.sasdy@ensimag.imag.fr>
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
Previous: Guillaume SasdyNext: Guillaume Sasdy
Message 11 of 21 in “Test environment for Git-MediaWiki”
  1. Test environment for Git-MediaWikiSimon.Cathebras, May 30, 2012
  2. 1/3 Script to install, delete and clear a MediaWikiSimon Cathebras, May 30, 2012
  3. 2/3 Test environment of git-remote-mwSimon Cathebras, May 30, 2012
  4. Matthieu MoyMay 31, 2012
  5. Simon.CathebrasJun 1, 2012
  6. Matthieu MoyJun 1, 2012
  7. Matthieu MoyJun 1, 2012
  8. 3/3 Tests file for git-remote-mediawikiSimon Cathebras, May 30, 2012
  9. Matthieu MoyMay 31, 2012
  10. 1/2 FIX: t9360. NEW test t9361 for git pull and git pushGuillaume Sasdy, May 31, 2012
  11. 2/2 FIX: Syntax of shell and perl scripts and posix compliantGuillaume Sasdy, May 31, 2012
  12. FIX: Syntax of shell and perl scripts and posix compliantGuillaume Sasdy, May 31, 2012
  13. FIX: Syntax of shell and perl scripts and posix compliantGuillaume Sasdy, May 31, 2012
  14. 1/3 FIX: cmd_* moved to wiki_* in test-gitmw-lib.sh and other filesGuillaume Sasdy, May 31, 2012
  15. 1/3 Script to install, delete and clear a MediaWikiGuillaume Sasdy, Jun 1, 2012
  16. 2/3 Test environment of git-remote-mwGuillaume Sasdy, Jun 1, 2012
  17. Matthieu MoyJun 1, 2012
  18. Simon.CathebrasJun 1, 2012
  19. Matthieu MoyJun 2, 2012
  20. Simon.CathebrasJun 4, 2012
  21. 3/3 Tests file for git-remote-mediawikiGuillaume Sasdy, Jun 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.