def test_check_for_errors_does_not_raise_an_exception_if_there_is_an_empty_error_log(self): contents = ["var example = function() {\n", " console.log('This is a different example');\n", "}"] sut.write_buffer_contents_to_file(JS_FILE, contents) sut.run_js_to_coffee_on_js_file() with self.assertRaises(AssertionError): with self.assertRaises(Exception): sut.check_for_errors()
def test_check_for_errors_does_not_raise_an_exception_if_there_is_an_empty_error_log(self): contents = ['for name in ["Toran", "Matt", "Brandon", "Joel"]\n', " console.log(name)"] sut.write_buffer_contents_to_file(COFFEE_FILE, contents) sut.run_coffee_to_js_on_coffee_file() with self.assertRaises(AssertionError): with self.assertRaises(Exception): sut.check_for_errors()
def test_check_for_errors_raises_an_exception_if_there_is_a_non_empty_error_log(self): contents = ["var bad_example = function() \n", " console.log('This is another example');\n", "}"] sut.write_buffer_contents_to_file(JS_FILE, contents) sut.run_js_to_coffee_on_js_file() self.assertTrue(os.stat(ERROR_LOG)[stat.ST_SIZE] > 0) with self.assertRaises(Exception): sut.check_for_errors()
def test_check_for_errors_raises_an_exception_if_there_is_a_non_empty_error_log(self): contents = ['for name in ["Jarrod", "Adam"'] sut.write_buffer_contents_to_file(COFFEE_FILE, contents) sut.run_coffee_to_js_on_coffee_file() self.assertTrue(os.stat(ERROR_LOG)[stat.ST_SIZE] > 0) with self.assertRaises(Exception): sut.check_for_errors()