git @ Cat's Eye Technologies Falderal / a561c48
For #2, new dev branch, write test, apply patch from @j4james. Chris Pressey 3 years ago
4 changed file(s) with 21 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
00 History
11 =======
2
3 Version 0.12 "Schoenhofen Brewery" (current development version):
4
5 * When expanding variables in declaration strings, use
6 `string.replace` instead of `re.sub` so that backslash-escaping
7 is not perfomed on the replacement string. (Thanks to
8 James Holderness for bug report and patch.)
29
310 Version 0.11 "Dan Ryan Expressway" (current released version):
411
772772 file.close()
773773 os.close(fd)
774774 # replace all occurrences in command
775 command = re.sub(r'\%\(test-body-file\)', test_filename, command)
775 command = command.replace('%(test-body-file)', test_filename)
776776 command_contained_test_body_file = True
777777
778778 if '%(test-body-text)' in self.command:
779779 # escape all single quotes in body
780780 body = re.sub(r"'", r"\'", body)
781781 # replace all occurrences in command
782 command = re.sub(r'\%\(test-body-text\)', body, command)
782 command = command.replace('%(test-body-text)', body)
783783 command_contained_test_body_text = True
784784
785785 if '%(test-input-file)' in self.command:
791791 file.close()
792792 os.close(fd)
793793 # replace all occurrences in command
794 command = re.sub(r'\%\(test-input-file\)', test_input_filename, command)
794 command = command.replace('%(test-input-file)', test_input_filename)
795795 command_contained_test_input_file = True
796796
797797 if '%(test-input-text)' in self.command:
798798 # escape all single quotes in input
799799 body = re.sub(r"'", r"\'", body)
800800 # replace all occurrences in command
801 command = re.sub(r'\%\(test-input-text\)', input, command)
801 command = command.replace('%(test-input-text)', input)
802802 command_contained_test_input_text = True
803803
804804 if '%(output-file)' in self.command:
806806 fd, output_filename = mkstemp()
807807 os.close(fd)
808808 # replace all occurrences in command
809 command = re.sub(r'\%\(output-file\)', output_filename, command)
809 command = command.replace('%(output-file)', output_filename)
810810
811811 # subshell the command and return the output
812812 pipe = Popen(command, shell=True,
00 --------------------------------
1 Total test runs: 10, failures: 0
1 Total test runs: 11, failures: 0
22 --------------------------------
3131 | hi
3232 = hi
3333 = hi
34
35 Note that when variables are expanded, backslash sequences in the
36 replacement string ("\n", etc) are not expanded.
37
38 -> Tests for functionality "Echo"
39
40 | he\nl\tl\\o
41 = he\nl\tl\\o
3442
3543 Note that single quotes needn't be supplied around `%(test-body-file)`
3644 or `%(output-file)`.