def test_code_with_debugger(self): script = "debugger;" checker = JavascriptChecker('bogus', script, self.reporter) checker.check_text() self.assertEqual( [(1, 'Line contains a call to debugger.')], self.reporter.messages)
def test_invalid_value(self): if JS is None: return self.file.write(invalid_js) self.file.flush() checker = JavascriptChecker(self.file.name, invalid_js, self.reporter) checker.check() self.assertEqual( [(1, "Expected ';' and instead saw '(end)'.")], self.reporter.messages)
def create_and_check(self, file_name, text): """Used by the TestAnyTextMixin tests.""" checker = JavascriptChecker(file_name, text, self.reporter) checker.check_text()
def test_good_js(self): self.file.write(good_js) self.file.flush() checker = JavascriptChecker(self.file.name, good_js, self.reporter) checker.check() self.assertEqual([], self.reporter.messages)