Examples of JSLintResult


Examples of com.googlecode.jslint4java.JSLintResult

        int failures = 0;
        ReportWriter reporter = new ReportWriter(new File(outputFolder, JSLINT_XML), new JSLintXmlFormatter());
        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

Examples of com.googlecode.jslint4java.JSLintResult

    // Eclipse's static analysis thinks I never close the UnicodeBomInputStream below.
    private void lintFile(String file) throws IOException {
        BufferedReader reader = null;
        try {
            reader = readerForFile(file);
            JSLintResult result = lint.lint(file, reader);
            String msg = formatter.format(result);
            if (msg.length() > 0) {
                info(msg);
            }
            if (!result.getIssues().isEmpty()) {
                setErrored(true);
            }
        } catch (FileNotFoundException e) {
            die(file + ": No such file or directory.");
        } finally {
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @Test
    public void testFileSetReallyIsFile() throws Exception {
        thrown.expect(BuildException.class);
        thrown.expectMessage("must be a directory");
        JSLintResult result = aResult("foo.js");
        formatter.setFile(folder.newFile("foo"));
        formatResult(result);
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

    @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

Examples of com.googlecode.jslint4java.JSLintResult

        runTest(result);
    }

    @Test
    public void testXmlOutputGood() throws Exception {
        JSLintResult result = new JSLintResult.ResultBuilder("main.js").build();
        runTest(result);
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

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

    @Test
    public void shouldHaveNoProblems() throws Exception {
        JSLintResult result = new JSLintResult.ResultBuilder("hello.js").duration(0).build();
        String expected = "<file name=\"hello.js\" />";
        XMLAssert.assertXMLEqual(expected, form.format(result));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

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

Examples of com.googlecode.jslint4java.JSLintResult

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

Examples of com.googlecode.jslint4java.JSLintResult

    public void testNoProblems() throws Exception {
        String expected = "<testsuite failures=\"0\" time=\"0.000\" errors=\"0\" skipped=\"0\" "
                + "tests=\"1\" name=\"hello.js\">"
                + "<testcase time=\"0.000\" classname=\"com.googlecode.jslint4java\" name=\"hello.js\" />"
                + "</testsuite>";
        JSLintResult result = new JSLintResult.ResultBuilder("hello.js").duration(0).build();
        XMLAssert.assertXMLEqual(expected, form.format(result));
    }
View Full Code Here

Examples of com.googlecode.jslint4java.JSLintResult

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