| 88 | self.cli_options = cli_options or {} |
| 89 | |
| 90 | def _create_test(self, cmd, expected_lines, line_num, timeout, expected_fail, options, strip_output, exit_check, empty_output): |
| 91 | # Reconstruct expected output preserving shell-like behavior. |
| 92 | # If there are expected lines, standard shell commands usually end with a newline. |
| 93 | # ["foo"] -> "foo\n" |
| 94 | # [""] -> "\n" |
| 95 | # [] -> "" |
| 96 | if expected_lines: |
| 97 | expected_str = "\n".join(expected_lines) + "\n" |
| 98 | else: |
| 99 | expected_str = "" |
| 100 | return ShellTest(cmd, expected_str, line_num, timeout, expected_fail, options.copy(), strip_output, exit_check, empty_output) |
| 101 | |
| 102 | def _extract_heredoc_delimiter(self, cmd): |
| 103 | """Extract heredoc delimiter from a command if present. |