Package org.opensolaris.opengrok.analysis.sh

Examples of org.opensolaris.opengrok.analysis.sh.ShXref


        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 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)));
View Full Code Here


     * is properly reset now.
     */
    @Test
    public void bug16883() throws Exception {
        // Analyze a script with broken syntax (unterminated string literal)
        ShXref xref = new ShXref(new StringReader("echo \"xyz"));
        StringWriter out = new StringWriter();
        xref.write(out);
        assertEquals(
                FIRST_LINE_PREAMBLE +
                    "<b>echo</b> <span class=\"s\">\"xyz</span>",
                out.toString());

        // Reuse the xref and verify that the broken syntax in the previous
        // file doesn't cause broken highlighting in the next file
        out = new StringWriter();
        String contents = "echo \"hello\"";
        xref.reInit(contents.toCharArray(), contents.length());
        xref.write(out);
        assertEquals(
                FIRST_LINE_PREAMBLE +
                    "<b>echo</b> <span class=\"s\">\"hello\"</span>",
                out.toString());
    }
View Full Code Here

                "cat<<EOF\n" +
                "This shouldn't cause any problem.\n" +
                "EOF\n" +
                "var='some string'\n");

        ShXref xref = new ShXref(in);
        StringWriter out = new StringWriter();
        xref.write(out);

        String[] result = out.toString().split("\n");

        // The single-quote on line 2 shouldn't start a string literal.
        assertTrue(result[1].endsWith("This shouldn't cause any problem."));
View Full Code Here

     * Test that unterminated heredocs don't cause infinite loop in ShXref.
     * This originally became a problem after upgrade to JFlex 1.5.0.
     */
    @Test
    public void unterminatedHeredoc() throws IOException {
        ShXref xref = new ShXref(new StringReader(
                "cat << EOF\nunterminated heredoc"));

        StringWriter out = new StringWriter();

        // The next call used to loop forever.
        xref.write(out);

        assertEquals("<a class=\"l\" name=\"1\" href=\"#1\">1</a>"
            + "<a href=\"/source/s?defs=cat\">cat</a> &lt;&lt; EOF"
            + "<span class=\"s\">\n"
            + "<a class=\"l\" name=\"2\" href=\"#2\">2</a>"
View Full Code Here

TOP

Related Classes of org.opensolaris.opengrok.analysis.sh.ShXref

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.