Extract heredoc delimiter from a command if present. Supports patterns like: - << EOF - <<EOF - << 'EOF' - << "EOF" - <<- EOF (with tab stripping) Returns the delimiter string (unquoted) or None if no heredoc.
(self, cmd)
| 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. |
| 104 | |
| 105 | Supports patterns like: |
| 106 | - << EOF |
| 107 | - <<EOF |
| 108 | - << 'EOF' |
| 109 | - << "EOF" |
| 110 | - <<- EOF (with tab stripping) |
| 111 | |
| 112 | Returns the delimiter string (unquoted) or None if no heredoc. |
| 113 | """ |
| 114 | # Match heredoc pattern: <<[-][ ]?['"]?WORD['"]? |
| 115 | match = re.search(r'<<-?\s*[\'"]?(\w+)[\'"]?\s*$', cmd) |
| 116 | if match: |
| 117 | return match.group(1) |
| 118 | return None |
| 119 | |
| 120 | def parse(self): |
| 121 | tests = [] |