def test_write_buffer_contents_to_file_writes_correct_contents_to_desired_file( self): buffer_contents = [ "var example = function() {", " console.log('this is an example');", "}" ] sut.write_buffer_contents_to_file(RESULTS_FILE, buffer_contents) with open(RESULTS_FILE, "r") as f: self.assertEqual(f.readlines(), [line + "\n" for line in buffer_contents])
def test_execute_file_with_specific_shell_program_populates_an_error_file_when_given_invalid_input_for_specified_shell_command( self): sut.write_buffer_contents_to_file( INPUT_FILE, ["(def name 'Jarrod')", "(println name)"]) sut.execute_file_with_specified_shell_program('python') self.assertTrue(os.stat(ERROR_LOG)[stat.ST_SIZE] > 0)
def test_execute_file_with_specific_shell_program_populates_an_error_file_when_given_invalid_input_for_specified_shell_command(self): sut.write_buffer_contents_to_file(INPUT_FILE, ["(def name 'Jarrod')", "(println name)"]) sut.execute_file_with_specified_shell_program('python') self.assertTrue(os.stat(ERROR_LOG)[stat.ST_SIZE] > 0)
def test_write_buffer_contents_to_file_writes_correct_contents_to_desired_file(self): buffer_contents = ["var example = function() {", " console.log('this is an example');", "}"] sut.write_buffer_contents_to_file(RESULTS_FILE, buffer_contents) with open(RESULTS_FILE, "r") as f: self.assertEqual(f.readlines(), [line + "\n" for line in buffer_contents])