use of org.opensolaris.opengrok.analysis.plain.PlainXref in project OpenGrok by OpenGrok.
the class RuntimeEnvironmentTest method assertObfuscated.
private void assertObfuscated(boolean expected, RuntimeEnvironment env) throws IOException {
assertEquals(expected, env.isObfuscatingEMailAddresses());
String address = "discuss@opengrok.java.net";
PlainXref xref = new PlainXref(new StringReader(address));
StringWriter out = new StringWriter();
xref.write(out);
String expectedAddress = expected ? address.replace("@", " (at) ") : address;
String expectedOutput = "<a class=\"l\" name=\"1\" href=\"#1\">1</a>" + expectedAddress;
assertEquals(expectedOutput, out.toString());
}
use of org.opensolaris.opengrok.analysis.plain.PlainXref in project OpenGrok by OpenGrok.
the class JFlexXrefTest method testEscapeLink.
/**
* Test that special characters in URLs are escaped in the xref.
*/
@Test
public void testEscapeLink() throws IOException {
StringReader in = new StringReader("http://www.example.com/?a=b&c=d");
PlainXref xref = new PlainXref(in);
StringWriter out = new StringWriter();
xref.write(out);
assertTrue(out.toString().contains("<a href=\"http://www.example.com/?a=b&c=d\">" + "http://www.example.com/?a=b&c=d</a>"));
}
use of org.opensolaris.opengrok.analysis.plain.PlainXref in project OpenGrok by OpenGrok.
the class JFlexXrefTest method testBug15890LineCount.
/**
* Regression test case for bug #15890. Check that we get the expected the
* expected line count from input with some special characters that used
* to cause trouble.
*/
@Test
public void testBug15890LineCount() throws Exception {
String fileContents = "line 1\n" + "line 2\n" + "line 3\n" + "line 4 with char\n" + "line 5 with char\n" + "line 6 with
char\n" + "line 7 with
char\n" + "line 8 with
char\n" + "line 9\n";
bug15890LineCount(new CXref(new StringReader(fileContents)));
bug15890LineCount(new CxxXref(new StringReader(fileContents)));
bug15890LineCount(new LispXref(new StringReader(fileContents)));
bug15890LineCount(new JavaXref(new StringReader(fileContents)));
bug15890LineCount(new ScalaXref(new StringReader(fileContents)));
bug15890LineCount(new FortranXref(new StringReader(fileContents)));
bug15890LineCount(new HaskellXref(new StringReader(fileContents)));
bug15890LineCount(new XMLXref(new StringReader(fileContents)));
bug15890LineCount(new ShXref(new StringReader(fileContents)));
bug15890LineCount(new TclXref(new StringReader(fileContents)));
bug15890LineCount(new SQLXref(new StringReader(fileContents)));
bug15890LineCount(new TroffXref(new StringReader(fileContents)));
bug15890LineCount(new PlainXref(new StringReader(fileContents)));
bug15890LineCount(new PerlXref(new StringReader(fileContents)));
}
Aggregations