See developers/testing.html for more explanations.
Function | split | Split a command line respecting quotes. |
Class | ScriptRunner | Run a shell-like script from a test. |
Class | TestCaseWithMemoryTransportAndScript | Helper class to experiment shell-like test and memory fs. |
Class | TestCaseWithTransportAndScript | Helper class to quickly define shell-like tests. |
Function | run_script | Run the given script within a testcase |
Function | _script_to_commands | Turn a script into a list of commands with their associated IOs. |
Function | _scan_redirection_options | Recognize and process input and output redirections. |
Turn a script into a list of commands with their associated IOs. Each command appears on a line by itself starting with '$ '. It can be associated with an input that will feed it and an expected output. Comments starts with '#' until the end of line. Empty lines are ignored. Input and output are full lines terminated by a ' '. Input lines start with '<'. Output lines start with nothing. Error lines start with '2>'. :return: A sequence of ([args], input, output, errors), where the args are split in to words, and the input, output, and errors are just strings, typically containing newlines.
Parameters | args | The command line arguments |
Returns | A tuple containing: - The file name redirected from or None - The file name redirected to or None - The mode to open the output file or None - The reamining arguments |