]> source.dussan.org Git - aspectj.git/commitdiff
better diagnostic message.
authoraclement <aclement>
Fri, 4 Aug 2006 11:03:08 +0000 (11:03 +0000)
committeraclement <aclement>
Fri, 4 Aug 2006 11:03:08 +0000 (11:03 +0000)
testing/newsrc/org/aspectj/testing/OutputSpec.java

index edc870022ea4229060e6c31eed9a485ec64bc462..d45208af895888667ce96d30b67cd52276d54daf 100644 (file)
@@ -41,19 +41,23 @@ public class OutputSpec {
                                        break;
                                }
                        }
-               }
+               } else { lineNo = -1; }
                if (!matches) {
                        StringBuffer failMessage = new StringBuffer();
-                       failMessage.append("Expecting output:\n");
+                       failMessage.append("\n  expecting output:\n");
+                       int l = 0;
                        for (Iterator iter = expectedOutputLines.iterator(); iter.hasNext();) {
                                String line = (String) iter.next();
                                failMessage.append(line);
                                failMessage.append("\n");
                        }
-                       failMessage.append("But found output:\n");
+                       failMessage.append("  but found output:\n");
                        failMessage.append(output);
                        failMessage.append("\n");
-                       failMessage.append("First difference is on line " + lineNo);
+                       if (lineNo==-1) 
+                               failMessage.append("Expected "+expectedOutputLines.size()+" lines of output but there are "+strTok.countTokens());
+                       else
+                               failMessage.append("First difference is on line " + lineNo);
                        failMessage.append("\n");
                        AjcTestCase.fail(failMessage.toString());
                }