seed r810 - trunk/tests



Author: hortont
Date: Mon Jan 26 00:33:36 2009
New Revision: 810
URL: http://svn.gnome.org/viewvc/seed?rev=810&view=rev

Log:
Tests now give diffs, instead of just printing both outputs!



Modified:
   trunk/tests/run-tests.py

Modified: trunk/tests/run-tests.py
==============================================================================
--- trunk/tests/run-tests.py	(original)
+++ trunk/tests/run-tests.py	Mon Jan 26 00:33:36 2009
@@ -8,6 +8,7 @@
 import re
 import sys
 import subprocess
+import difflib
 
 passed = []
 failed = []
@@ -76,11 +77,17 @@
 	print "-------------FAILED TEST---------------"
 	print "Name: %s" % fail[0]
 	if fail[3] == 1:
-		print "  Expected Error:\t" + fail[1]
-		print "  Actual Error:\t" + fail[2]
+		for line in difflib.unified_diff(fail[1].replace("\\","").replace("^","").replace("$","").split("\n"),
+										 fail[2].split("\n"),
+										 fromfile="Expected Error",
+										 tofile="Actual Error"):
+			print line.rstrip()
 	elif fail[3] == 0:
-		print "  Expected Output:\t" + fail[1]
-		print "  Actual Output:\t" + fail[2]
+		for line in difflib.unified_diff(fail[1].replace("\\","").replace("^","").replace("$","").split("\n"),
+										 fail[2].split("\n"),
+										 fromfile="Expected Output",
+										 tofile="Actual Output"):
+			print line.rstrip()
 		print "  Error Output:\t\t" + fail[4]
 	elif fail[3] == 2:
 		print "  Expected Retval:\t%d" % fail[1]



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