]> source.dussan.org Git - aspectj.git/commitdiff
output line numbers in stdout/err comparisons from test harness
authoracolyer <acolyer>
Wed, 9 Mar 2005 11:17:15 +0000 (11:17 +0000)
committeracolyer <acolyer>
Wed, 9 Mar 2005 11:17:15 +0000 (11:17 +0000)
testing/newsrc/org/aspectj/testing/OutputSpec.java

index abeae90d278a624bd203170f6eacdfc482ef0410..be869bfbbc999c5de44fbf700f70b942b3d0ec89 100644 (file)
@@ -27,11 +27,13 @@ public class OutputSpec {
        
        public void matchAgainst(String output) {
                boolean matches = false;
+               int lineNo = 0;
                StringTokenizer strTok = new StringTokenizer(output,"\n");
                if (strTok.countTokens() == expectedOutputLines.size()) {
                        matches = true;
                        for (Iterator iter = expectedOutputLines.iterator(); iter.hasNext();) {
                                String line = (String) iter.next();
+                               lineNo++;
                                String outputLine = strTok.nextToken().trim();
                                if (!line.equals(outputLine)) {
                                        matches = false;
@@ -50,6 +52,8 @@ public class OutputSpec {
                        failMessage.append("But found output:\n");
                        failMessage.append(output);
                        failMessage.append("\n");
+                       failMessage.append("First difference is on line " + lineNo);
+                       failMessage.append("\n");
                        AjcTestCase.fail(failMessage.toString());
                }
        }