コード例 #1
0
 @Test
 public void canLintWithBom() throws Exception {
   InputStream is = UnicodeBomInputStreamTest.class.getResourceAsStream("bom.js");
   UnicodeBomInputStream is2 = new UnicodeBomInputStream(is);
   is2.skipBOM();
   InputStreamReader isr = new InputStreamReader(is2, Charset.forName("UTF-8"));
   JSLint jsLint = new JSLintBuilder().fromDefault();
   jsLint.addOption(Option.UNDEF);
   JSLintResult result = jsLint.lint("bom.js", isr);
   assertThat(result.getIssues().size(), is(0));
 }
コード例 #2
0
 /** A minimal test that a JSLint looks OK. Just tests we can lint an empty string. */
 private void assertJSLintOK(JSLint lint) {
   assertThat(lint, is(notNullValue()));
   // Check it can lint OK.
   List<Issue> issues = lint.lint("-", "").getIssues();
   assertThat(issues.isEmpty(), is(true));
 }