Package com.googlecode.jslint4java

Examples of com.googlecode.jslint4java.Issue


    }

    @Test
    public void testExpectedOutputOneIssue() {
        File file = new File("foo/bar.js");
        Issue issue = new IssueBuilder(file.toString(), 1, 1, "no clucking").evidence("cluck()")
                .build();
        issues.add(issue);
        runFormatter(file);
        // Build up the expected output in a cross-platform manner.
        String nl = System.getProperty("line.separator");
View Full Code Here


     * When there's no evidence, we shouldn't print a blank line or a caret.
     */
    @Test
    public void testNoEvidence() throws Exception {
        File file = new File("foo/bar.js");
        Issue issue = new IssueBuilder(file.toString(), 1, 1, "fatality").build();
        issues.add(issue);
        runFormatter(file);
        // Build up the expected output in a cross-platform manner.
        String nl = System.getProperty("line.separator");
        StringBuilder sb = new StringBuilder(file.toString());
View Full Code Here

    }

    @Test
    public void testXmlOutputBad() throws Exception {
        String name = "main.js";
        Issue issue = new Issue.IssueBuilder(name, 1, 1, "smelly socks").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
        runTest(result);
    }
View Full Code Here

    }

    @Test
    public void shouldHaveOneProblem() throws Exception {
        String name = "bad.js";
        Issue issue = new Issue.IssueBuilder(name, 1, 1, "this is not a daffodil").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
        String expected = "<file name=\"bad.js\">"
                + "<error line='1' column='1' severity='warning' message='this is not a daffodil'"
                + " source='com.googlecode.jslint4java.JSLint' />"
                + "</file>";
View Full Code Here

                + "name=\"&quot;a&amp;b&apos;.js\">"
                + "<failure message=\"Found 1 problem\" type=\"java.lang.AssertionError\">"
                + "\"a&amp;b'.js:1:1:I&lt;&amp;&gt;Like&lt;angle&gt;&gt;\"brackets'\n"
                + "</failure>" + "</testcase>" + "</testsuite>";
        String name = "\"a&b\'.js";
        Issue issue = new Issue.IssueBuilder(name, 1, 1, "I<&>Like<angle>>\"brackets\'").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).duration(0).addIssue(issue)
                .build();
        XMLAssert.assertXMLEqual(expected, form.format(result));
    }
View Full Code Here

                + "<testcase time=\"0.000\" classname=\"com.googlecode.jslint4java\" name=\"hello.js\">"
                + "<failure message=\"Found 1 problem\" type=\"java.lang.AssertionError\">"
                + "hello.js:1:1:too many aardvarks\n" + "</failure>" + "</testcase>"
                + "</testsuite>";
        String name = "hello.js";
        Issue issue = new Issue.IssueBuilder(name, 1, 1, "too many aardvarks").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).duration(0).addIssue(issue)
                .build();
        XMLAssert.assertXMLEqual(expected, form.format(result));
    }
View Full Code Here

                + "<testcase time=\"0.000\" classname=\"com.googlecode.jslint4java\" name=\"hello.js\">"
                + "<failure message=\"Found 2 problems\" type=\"java.lang.AssertionError\">"
                + "hello.js:1:1:too many aardvarks\n" + "hello.js:1:2:too few aardvarks\n"
                + "</failure>" + "</testcase>" + "</testsuite>";
        String name = "hello.js";
        Issue issue1 = new Issue.IssueBuilder(name, 1, 1, "too many aardvarks").build();
        Issue issue2 = new Issue.IssueBuilder(name, 1, 2, "too few aardvarks").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).duration(0).addIssue(issue1)
                .addIssue(issue2).build();
        XMLAssert.assertXMLEqual(expected, form.format(result));
    }
View Full Code Here

    }

    @Test
    public void testOneIssue() throws Exception {
        String name = "bad.js";
        Issue issue = new Issue.IssueBuilder(name, 1, 1, "too many goats teleported").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
        String expected = "<file name='bad.js'>"
                + "<issue line='1' char='1' reason='too many goats teleported' evidence='' />"
                + "</file>";
        String actual = form.format(result);
View Full Code Here

    /** We don't expect this to happen, but we shouldn't blow up either. @see issue 85 */
    @Test
    public void shouldCopeWithCharacterZero() throws Exception {
        String nl = System.getProperty("line.separator");
        String name = "foo/bar.js";
        Issue issue = new IssueBuilder(name, 0, 0, "oops").evidence("BANG").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
        StringBuilder sb = new StringBuilder(name);
        sb.append(":0:0: oops").append(nl);
        sb.append("BANG").append(nl);
        sb.append("^").append(nl);
View Full Code Here

    @Test
    public void testExpectedOutputOneIssue() {
        String nl = System.getProperty("line.separator");
        String name = "foo/bar.js";
        Issue issue = new IssueBuilder(name, 1, 2, "no clucking").evidence("cluck()").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
        StringBuilder sb = new StringBuilder(name);
        sb.append(":1:2: no clucking").append(nl);
        sb.append("cluck()").append(nl);
        sb.append(" ^").append(nl);
View Full Code Here

TOP

Related Classes of com.googlecode.jslint4java.Issue

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.