Examples of JSLintResult


Examples of com.googlecode.jslint4java.JSLintResult

                + "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

Examples of com.googlecode.jslint4java.JSLintResult

        assertThat(form.header(), is("<jslint>"));
    }

    @Test
    public void testNoOutput() throws Exception {
        JSLintResult result = new JSLintResult.ResultBuilder("good.js").build();
        String expected = "<file name='good.js'/>";
        String actual = form.format(result);
        XMLAssert.assertXMLEqual(expected, actual);
        XMLAssert.assertXMLValid(getValidatorFor(actual));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @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);
        XMLAssert.assertXMLEqual(expected, actual);
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

        assertThat(form.header(), is("<html><head></head><body>"));
    }

    @Test
    public void testEscaping() throws Exception {
        JSLintResult result = mockResult("'a<b&c>d\".js");
        String expected = "<h1 id='&apos;a&lt;b&amp;c&gt;d&quot;.js'>'a&lt;b&amp;c&gt;d\".js</h1>";
        assertThat(form.format(result).contains(expected), is(true));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @Test
    public void testOutput() throws Exception {
        // Normally, JSLint produces non-xml reports (though they are HTML). But as we control the
        // input we can get away with using xmlunit to make the check for us. We still have to
        // accommodate the extra div that we insert.
        JSLintResult result = mockResult("foo.js");
        String expected = "<div class='file'>" + "<h1 id='foo.js'>foo.js</h1>"
                + "<div>undefined cat: schrodinger</div>" + "</div>";
        XMLUnit.compareXML(expected, form.format(result));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @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);
        assertThat(rf.format(result), is(sb.toString()));
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

        assertThat(rf.header(), is(nullValue()));
    }

    @Test
    public void testExpectedOutputNoIssues() {
        JSLintResult result = new JSLintResult.ResultBuilder("foo/bar.js").build();
        String out = rf.format(result);
        assertThat(out, is(""));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @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);
        assertThat(rf.format(result), is(sb.toString()));
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @Test
    public void testNoEvidence() throws Exception {
        String nl = System.getProperty("line.separator");
        String name = "foo/bar.js";
        Issue issue = new IssueBuilder(name, 1, 1, "fatality").build();
        JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build();
        StringBuilder sb = new StringBuilder(name);
        sb.append(":1:1: fatality");
        sb.append(nl);
        assertThat(rf.format(result), is(sb.toString()));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

        int failures = 0;
        ReportWriter reporter = makeReportWriter();
        try {
            reporter.open();
            for (File file : files) {
                JSLintResult result = lintFile(jsLint, file);
                failures += result.getIssues().size();
                logIssues(result, reporter);
            }
        } finally {
            reporter.close();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.