Commits

J. Ryan Stinnett committed 20ec09e

Corrected xref appearance after test changes

Comments (0)

Files changed (3)

bazaarvoice-customizations

 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295427006 21600
+# Date 1295431445 21600
 # Node ID a0baf2a260b3a7d8c496cd32e7b323a571462f52
-# Parent 2edff6e17155dd12ced3ae77475befe893c9bbe9
+# Parent 4650ff3ed1bced3aceb844412685d9d4f994aa52
 Bazaarvoice-specific customizations
 
 diff --git a/src/org/opensolaris/opengrok/search/Results.java b/src/org/opensolaris/opengrok/search/Results.java
 @@ -63,7 +63,7 @@
       * This is what we expect to find before the content of a single line input.
       */
-     private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">\n" +
--            "<a class=\"l\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
-+            "<a class=\"l\" href=\"#1\">1</a>\n" +
-             "</td><td id=\"line_content\">\n" +
+     private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">" +
+-            "<a class=\"l\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>" +
++            "<a class=\"l\" href=\"#1\">1</a>" +
+             "</td><td id=\"line_content\">" +
              "<div id=\"f:1\">";
  
 diff --git a/test/org/opensolaris/opengrok/search/context/ContextTest.java b/test/org/opensolaris/opengrok/search/context/ContextTest.java
 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295427373 21600
+# Date 1295431261 21600
 # Node ID e531bb8f756c408c77f86fd719de68ad2fe83aba
-# Parent bf737176de80fab0dd0939140ae9a5e146e539c6
+# Parent 707f770da7e0c050e63b8385abcd946a196df739
 Change to a table for xrefs for easier copying
 
 diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
          writeSymbolTable();
 +
 +        // Start table and line number column
-+        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n");
++        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>");
          setLineNumber(0);
          startNewLine();
          while (yylex() != yyeof) { // NOPMD while statement intentionally empty
 +        endCurrentLine();
 +
 +        // End line number column and write the file contents
-+        xrefOut.write("\n</td><td>\n");
++        xrefOut.write("</td><td>");
 +        xrefOut.write(out.toString());
 +        xrefOut.write("</td></tr></table>");
      }
 +            out.write("</span>");
 +        }
 +
-+        out.write("</div>\n");
++        out.write("</div>");
      }
  
      /**
 -    private static final String FIRST_LINE_PREAMBLE =
 -                "<a class=\"l\" name=\"1\" href=\"#1\">" +
 -                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>";
-+    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n" +
-+            "<a class=\"l\" name=\"1\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
-+            "</td><td>\n" +
++    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>" +
++            "<a class=\"l\" name=\"1\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>" +
++            "</td><td>" +
 +            "<div>";
 +
 +    /**
 +     * This is what we expect to find after the content of a single line input.
 +     */
-+    private static final String SINGLE_LINE_SUFFIX = "<br/></div>\n" +
++    private static final String SINGLE_LINE_SUFFIX = "<br/></div>" +
 +            "</td></tr></table>";
  
      @BeforeClass
 diff --git a/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java b/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
 --- a/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
 +++ b/test/org/opensolaris/opengrok/analysis/plain/XMLAnalyzerTest.java
-@@ -48,9 +48,9 @@
+@@ -46,11 +46,11 @@
+         StringReader sr = new StringReader(xmlText);
+         StringWriter sw = new StringWriter();
          XMLAnalyzer.writeXref(sr, sw, null, null, null);
-         String[] xref = sw.toString().split("\n");
+-        String[] xref = sw.toString().split("\n");
++        String xref = sw.toString();
          // Reference to a Java class should have / instead of . in the path
 -        assertTrue(xref[2].contains("path=com/foo/bar/MyClass"));
-+        assertTrue(xref[9].contains("path=com/foo/bar/MyClass"));
++        assertTrue(xref.contains("path=com/foo/bar/MyClass"));
          // Ordinary file names should not have .'s replaced
 -        assertTrue(xref[3].contains("path=README.txt"));
-+        assertTrue(xref[10].contains("path=README.txt"));
++        assertTrue(xref.contains("path=README.txt"));
      }
  
      @Test
-@@ -66,9 +66,9 @@
+@@ -64,11 +64,11 @@
+         StringReader sr = new StringReader(xmlText);
+         StringWriter sw = new StringWriter();
          XMLAnalyzer.writeXref(sr, sw, null, null, null);
-         String[] xref = sw.toString().split("\n");
+-        String[] xref = sw.toString().split("\n");
++        String xref = sw.toString();
          // Name is one the recognized symbol attributes
 -        assertTrue(xref[2].contains("defs=bob"));
-+        assertTrue(xref[9].contains("defs=bob"));
++        assertTrue(xref.contains("defs=bob"));
          // Address is not a special attribute
 -        assertFalse(xref[3].contains("<a href"));
-+        assertFalse(xref[10].contains("<a href"));
++        assertFalse(xref.contains("defs=address"));
      }
  
      /**
 # HG changeset patch
 # User J. Ryan Stinnett <jryans@gmail.com>
-# Date 1295427427 21600
+# Date 1295431412 21600
 # Node ID cb9e8afb804c53f32f271da04674c823adf31f0f
-# Parent cf2503704c50e92030a4403d3ebc804d1ee08a53
+# Parent d85cac0e32518b54d349e8651c4f9d715d287ca5
 Adding centering and highlighting when targeting specific lines
 
 diff --git a/src/org/opensolaris/opengrok/analysis/JFlexXref.java b/src/org/opensolaris/opengrok/analysis/JFlexXref.java
          writeSymbolTable();
  
          // Start table and line number column
--        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n");
-+        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">\n");
+-        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>");
++        xrefOut.write("<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">");
          setLineNumber(0);
          startNewLine();
          while (yylex() != yyeof) { // NOPMD while statement intentionally empty
          endCurrentLine();
  
          // End line number column and write the file contents
--        xrefOut.write("\n</td><td>\n");
-+        xrefOut.write("\n</td><td id=\"line_content\">\n");
+-        xrefOut.write("</td><td>");
++        xrefOut.write("</td><td id=\"line_content\">");
          xrefOut.write(out.toString());
          xrefOut.write("</td></tr></table>");
      }
      /**
       * This is what we expect to find before the content of a single line input.
       */
--    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\n" +
--            "<a class=\"l\" name=\"1\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
--            "</td><td>\n" +
+-    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>" +
+-            "<a class=\"l\" name=\"1\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>" +
+-            "</td><td>" +
 -            "<div>";
-+    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">\n" +
-+            "<a class=\"l\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>\n" +
-+            "</td><td id=\"line_content\">\n" +
++    private static final String SINGLE_LINE_PREFIX = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td id=\"line_numbers\">" +
++            "<a class=\"l\" href=\"#1\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;</a>" +
++            "</td><td id=\"line_content\">" +
 +            "<div id=\"f:1\">";
  
      /**