check-code: add 'no tab indent' check for unified tests
authorAdrian Buehlmann <adrian@cadifra.com>
Sat, 16 Oct 2010 18:09:01 +0200
changeset 12743 4c4aeaab2339
parent 12742 6ab4a7d3c179
child 12744 0793d763e413
check-code: add 'no tab indent' check for unified tests and fix the offending tests accordingly
contrib/check-code.py
tests/test-convert-filemap.t
tests/test-convert-git.t
tests/test-hgweb-no-path-info.t
tests/test-hgweb-no-request-uri.t
tests/test-hgweb-non-interactive.t
tests/test-inherit-mode.t
tests/test-newcgi.t
tests/test-parentrevspec.t
tests/test-pull-http.t
tests/test-push-http.t
tests/test-rename-merge2.t
--- a/contrib/check-code.py	Sun Oct 17 04:14:06 2010 +0200
+++ b/contrib/check-code.py	Sat Oct 16 18:09:01 2010 +0200
@@ -72,6 +72,7 @@
 ]
 
 uprefix = r"^  \$ "
+uprefixc = r"^  > "
 utestpats = [
     (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
     (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
@@ -79,6 +80,7 @@
     (uprefix + r'.*\|\| echo.*(fail|error)',
      "explicit exit code checks unnecessary"),
     (uprefix + r'set -e', "don't use set -e"),
+    (uprefixc + r'( *)\t', "don't use tabs to indent"),
 ]
 
 for p, m in testpats:
--- a/tests/test-convert-filemap.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-convert-filemap.t	Sat Oct 16 18:09:01 2010 +0200
@@ -95,7 +95,7 @@
   >     fmap="$prefix.fmap"
   >     repo="$prefix.repo"
   >     for i in $files; do
-  > 	echo "include $i" >> "$fmap"
+  >         echo "include $i" >> "$fmap"
   >     done
   >     hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
   >     hg up -q -R "$repo"
--- a/tests/test-convert-git.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-convert-git.t	Sat Oct 16 18:09:01 2010 +0200
@@ -116,7 +116,7 @@
   >     fmap="$prefix.fmap"
   >     repo="$prefix.repo"
   >     for i in $files; do
-  > 	echo "include $i" >> "$fmap"
+  >         echo "include $i" >> "$fmap"
   >     done
   >     hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
   >     hg up -q -R "$repo"
--- a/tests/test-hgweb-no-path-info.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-hgweb-no-path-info.t	Sat Oct 16 18:09:01 2010 +0200
@@ -24,26 +24,26 @@
   > input = StringIO()
   > 
   > def startrsp(status, headers):
-  > 	print '---- STATUS'
-  > 	print status
-  > 	print '---- HEADERS'
-  > 	print [i for i in headers if i[0] != 'ETag']
-  > 	print '---- DATA'
-  > 	return output.write
+  >     print '---- STATUS'
+  >     print status
+  >     print '---- HEADERS'
+  >     print [i for i in headers if i[0] != 'ETag']
+  >     print '---- DATA'
+  >     return output.write
   > 
   > env = {
-  > 	'wsgi.version': (1, 0),
-  > 	'wsgi.url_scheme': 'http',
-  > 	'wsgi.errors': errors,
-  > 	'wsgi.input': input,
-  > 	'wsgi.multithread': False,
-  > 	'wsgi.multiprocess': False,
-  > 	'wsgi.run_once': False,
-  > 	'REQUEST_METHOD': 'GET',
-  > 	'SCRIPT_NAME': '',
-  > 	'SERVER_NAME': '127.0.0.1',
-  > 	'SERVER_PORT': os.environ['HGPORT'],
-  > 	'SERVER_PROTOCOL': 'HTTP/1.0'
+  >     'wsgi.version': (1, 0),
+  >     'wsgi.url_scheme': 'http',
+  >     'wsgi.errors': errors,
+  >     'wsgi.input': input,
+  >     'wsgi.multithread': False,
+  >     'wsgi.multiprocess': False,
+  >     'wsgi.run_once': False,
+  >     'REQUEST_METHOD': 'GET',
+  >     'SCRIPT_NAME': '',
+  >     'SERVER_NAME': '127.0.0.1',
+  >     'SERVER_PORT': os.environ['HGPORT'],
+  >     'SERVER_PROTOCOL': 'HTTP/1.0'
   > }
   > 
   > def process(app):
--- a/tests/test-hgweb-no-request-uri.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-hgweb-no-request-uri.t	Sat Oct 16 18:09:01 2010 +0200
@@ -24,35 +24,34 @@
   > input = StringIO()
   > 
   > def startrsp(status, headers):
-  > 	print '---- STATUS'
-  > 	print status
-  > 	print '---- HEADERS'
-  > 	print [i for i in headers if i[0] != 'ETag']
-  > 	print '---- DATA'
-  > 	return output.write
+  >     print '---- STATUS'
+  >     print status
+  >     print '---- HEADERS'
+  >     print [i for i in headers if i[0] != 'ETag']
+  >     print '---- DATA'
+  >     return output.write
   > 
   > env = {
-  > 	'wsgi.version': (1, 0),
-  > 	'wsgi.url_scheme': 'http',
-  > 	'wsgi.errors': errors,
-  > 	'wsgi.input': input,
-  > 	'wsgi.multithread': False,
-  > 	'wsgi.multiprocess': False,
-  > 	'wsgi.run_once': False,
-  > 	'REQUEST_METHOD': 'GET',
-  > 	'SCRIPT_NAME': '',
-  > 	'SERVER_NAME': '127.0.0.1',
-  > 	'SERVER_PORT': os.environ['HGPORT'],
-  > 	'SERVER_PROTOCOL': 'HTTP/1.0'
+  >     'wsgi.version': (1, 0),
+  >     'wsgi.url_scheme': 'http',
+  >     'wsgi.errors': errors,
+  >     'wsgi.input': input,
+  >     'wsgi.multithread': False,
+  >     'wsgi.multiprocess': False,
+  >     'wsgi.run_once': False,
+  >     'REQUEST_METHOD': 'GET',
+  >     'SCRIPT_NAME': '',
+  >     'SERVER_NAME': '127.0.0.1',
+  >     'SERVER_PORT': os.environ['HGPORT'],
+  >     'SERVER_PROTOCOL': 'HTTP/1.0'
   > }
   > 
   > def process(app):
-  > 	content = app(env, startrsp)
-  > 	sys.stdout.write(output.getvalue())
-  > 	sys.stdout.write(''.join(content))
-  > 	print '---- ERRORS'
-  > 	print errors.getvalue()
-  > 	
+  >     content = app(env, startrsp)
+  >     sys.stdout.write(output.getvalue())
+  >     sys.stdout.write(''.join(content))
+  >     print '---- ERRORS'
+  >     print errors.getvalue()
   > 
   > output = StringIO()
   > env['PATH_INFO'] = '/'
--- a/tests/test-hgweb-non-interactive.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-hgweb-non-interactive.t	Sat Oct 16 18:09:01 2010 +0200
@@ -34,28 +34,28 @@
   > output = StringIO()
   > 
   > def startrsp(status, headers):
-  > 	print '---- STATUS'
-  > 	print status
-  > 	print '---- HEADERS'
-  > 	print [i for i in headers if i[0] != 'ETag']
-  > 	print '---- DATA'
-  > 	return output.write
+  >     print '---- STATUS'
+  >     print status
+  >     print '---- HEADERS'
+  >     print [i for i in headers if i[0] != 'ETag']
+  >     print '---- DATA'
+  >     return output.write
   > 
   > env = {
-  > 	'wsgi.version': (1, 0),
-  > 	'wsgi.url_scheme': 'http',
-  > 	'wsgi.errors': errors,
-  > 	'wsgi.input': input,
-  > 	'wsgi.multithread': False,
-  > 	'wsgi.multiprocess': False,
-  > 	'wsgi.run_once': False,
-  > 	'REQUEST_METHOD': 'GET',
-  > 	'SCRIPT_NAME': '',
-  > 	'PATH_INFO': '',
-  > 	'QUERY_STRING': '',
-  > 	'SERVER_NAME': '127.0.0.1',
-  > 	'SERVER_PORT': os.environ['HGPORT'],
-  > 	'SERVER_PROTOCOL': 'HTTP/1.0'
+  >     'wsgi.version': (1, 0),
+  >     'wsgi.url_scheme': 'http',
+  >     'wsgi.errors': errors,
+  >     'wsgi.input': input,
+  >     'wsgi.multithread': False,
+  >     'wsgi.multiprocess': False,
+  >     'wsgi.run_once': False,
+  >     'REQUEST_METHOD': 'GET',
+  >     'SCRIPT_NAME': '',
+  >     'PATH_INFO': '',
+  >     'QUERY_STRING': '',
+  >     'SERVER_NAME': '127.0.0.1',
+  >     'SERVER_PORT': os.environ['HGPORT'],
+  >     'SERVER_PROTOCOL': 'HTTP/1.0'
   > }
   > 
   > i = hgweb('.')
--- a/tests/test-inherit-mode.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-inherit-mode.t	Sat Oct 16 18:09:01 2010 +0200
@@ -17,12 +17,12 @@
   > isdir = {}
   > for root, dirs, files in os.walk(sys.argv[1]):
   >     for d in dirs:
-  > 	name = os.path.join(root, d)
-  > 	isdir[name] = 1
-  > 	allnames.append(name)
+  >         name = os.path.join(root, d)
+  >         isdir[name] = 1
+  >         allnames.append(name)
   >     for f in files:
-  > 	name = os.path.join(root, f)
-  > 	allnames.append(name)
+  >         name = os.path.join(root, f)
+  >         allnames.append(name)
   > allnames.sort()
   > for name in allnames:
   >     suffix = name in isdir and '/' or ''
--- a/tests/test-newcgi.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-newcgi.t	Sat Oct 16 18:09:01 2010 +0200
@@ -16,7 +16,7 @@
   > from mercurial.hgweb.request import wsgiapplication
   > 
   > def make_web_app():
-  > 	return hgweb("test", "Empty test repository")
+  >     return hgweb("test", "Empty test repository")
   > 
   > wsgicgi.launch(wsgiapplication(make_web_app))
   > HGWEB
@@ -42,7 +42,7 @@
   > from mercurial.hgweb.request import wsgiapplication
   > 
   > def make_web_app():
-  > 	return hgwebdir("hgweb.config")
+  >     return hgwebdir("hgweb.config")
   > 
   > wsgicgi.launch(wsgiapplication(make_web_app))
   > HGWEBDIR
--- a/tests/test-parentrevspec.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-parentrevspec.t	Sat Oct 16 18:09:01 2010 +0200
@@ -6,11 +6,11 @@
   >     p2=$3
   > 
   >     if [ "$p1" ]; then
-  > 	hg up -qC $p1
+  >         hg up -qC $p1
   >     fi
   > 
   >     if [ "$p2" ]; then
-  > 	HGMERGE=true hg merge -q $p2
+  >         HGMERGE=true hg merge -q $p2
   >     fi
   > 
   >     echo >> foo
@@ -41,8 +41,8 @@
   $ lookup()
   > {
   >     for rev in "$@"; do
-  > 	printf "$rev: "
-  > 	hg id -nr $rev
+  >         printf "$rev: "
+  >         hg id -nr $rev
   >     done
   >     true
   > }
--- a/tests/test-pull-http.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-pull-http.t	Sat Oct 16 18:09:01 2010 +0200
@@ -29,12 +29,12 @@
 
   $ cat errors.log
   $ req() {
-  > 	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
-  > 	cat hg.pid >> $DAEMON_PIDS
-  > 	hg --cwd ../test pull http://localhost:$HGPORT/
-  > 	kill `cat hg.pid`
-  > 	echo % serve errors
-  > 	cat errors.log
+  >     hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
+  >     cat hg.pid >> $DAEMON_PIDS
+  >     hg --cwd ../test pull http://localhost:$HGPORT/
+  >     kill `cat hg.pid`
+  >     echo % serve errors
+  >     cat errors.log
   > }
 
 expect error, pulling not allowed
--- a/tests/test-push-http.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-push-http.t	Sat Oct 16 18:09:01 2010 +0200
@@ -13,12 +13,12 @@
   $ echo a >> a
   $ hg ci -mb
   $ req() {
-  > 	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
-  > 	cat hg.pid >> $DAEMON_PIDS
-  > 	hg --cwd ../test2 push http://localhost:$HGPORT/
-  > 	kill `cat hg.pid`
-  > 	echo % serve errors
-  > 	cat errors.log
+  >     hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
+  >     cat hg.pid >> $DAEMON_PIDS
+  >     hg --cwd ../test2 push http://localhost:$HGPORT/
+  >     kill `cat hg.pid`
+  >     echo % serve errors
+  >     cat errors.log
   > }
   $ cd ../test
 
--- a/tests/test-rename-merge2.t	Sun Oct 17 04:14:06 2010 +0200
+++ b/tests/test-rename-merge2.t	Sat Oct 16 18:09:01 2010 +0200
@@ -66,8 +66,8 @@
   >     cp rev $1
   >     hg add $1 2> /dev/null
   >     if [ "$2" != "" ] ; then
-  > 	cp rev $2
-  > 	hg add $2 2> /dev/null
+  >         cp rev $2
+  >         hg add $2 2> /dev/null
   >     fi
   > }
   $ uc() { up $1; hg cp $1 $2; } # update + copy