Пример #1
0
 def test_jshint_errors_should_return_true_normal_output(self):
     output = 'incorrect.js: line 1, col 17, Expected an identifier and ' \
         'instead saw \'=\'. (E030)\nincorrect.js: line 1, col 18, ' \
         'Missing semicolon. (W033)\nincorrect.js: line 1, col 18, ' \
         'Expected an assignment or function call and instead saw an ' \
         'expression. (W030)\n\n3 errors\n'
     self.assertTrue(jshint_errors(output, False))
Пример #2
0
 def test_jshint_errors_should_return_true_xml_output(self):
     output = '<?xml version="1.0" encoding="utf-8"?>\n' \
         '<jslint>\n' \
         '    <file name="incorrect.js">\n' \
         '        <issue line="1" char="17" reason="Expected an ' \
         'identifier and instead saw &apos;=&apos;." evidence="var ' \
         'number_ten= =10;var word_ten=&apos;ten&apos;;var ' \
         'sum_2_plus_2 = 2+2;" severity="E" />\n' \
         '        <issue line="1" char="18" reason="Missing semicolon." ' \
         'evidence="var number_ten= =10;var word_ten=&apos;ten&apos;;var' \
         ' sum_2_plus_2 = 2+2;" severity="W" />\n' \
         '        <issue line="1" char="18" reason="Expected an ' \
         'assignment or function call and instead saw an expression." '\
         'evidence="var number_ten= =10;var word_ten=&apos;ten&apos;;var' \
         ' sum_2_plus_2 = 2+2;" severity="W" />\n' \
         '    </file>\n' \
         '</jslint>'
     self.assertTrue(jshint_errors(output, True))
Пример #3
0
 def test_jshint_errors_should_return_false_normal_output(self):
     output = ''
     self.assertFalse(jshint_errors(output, False))
Пример #4
0
 def test_jshint_errors_should_return_false_xml_output(self):
     output = '<?xml version="1.0" encoding="utf-8"?>\n' \
              '<jslint>\n' \
              '</jslint>'
     self.assertFalse(jshint_errors(output, True))
 def test_jshint_errors_should_return_false_empty_normal_output(self):
     self.assertFalse(jshint_errors('', False))
 def test_jshint_errors_should_return_true_with_normal_output(self):
     self.assertTrue(jshint_errors(DEFAULT_OUTPUT, False))
 def test_jshint_errors_should_return_true_with_xml_output(self):
     self.assertTrue(jshint_errors(XML_OUTPUT, True))
 def test_jshint_errors_should_return_false_empty_xml_output(self):
     self.assertFalse(jshint_errors(XML_EMPTY_OUTPUT, True))