| 1934 | |
| 1935 | |
| 1936 | def test_multiline_history_with_quotes(multiline_app, monkeypatch) -> None: |
| 1937 | # Test combined multiline command with quotes is added to history correctly |
| 1938 | run_cmd(multiline_app, "history --clear") |
| 1939 | |
| 1940 | read_command_mock = mock.MagicMock(name="_read_command_line", side_effect=[" and spaces ", ' "', " in", "quotes.", ";"]) |
| 1941 | monkeypatch.setattr("cmd2.Cmd._read_command_line", read_command_mock) |
| 1942 | |
| 1943 | line = 'orate Look, "There are newlines' |
| 1944 | run_cmd(multiline_app, line) |
| 1945 | |
| 1946 | assert len(multiline_app.history) == 1 |
| 1947 | history_item = multiline_app.history.get(1) |
| 1948 | history_lines = history_item.raw.splitlines() |
| 1949 | assert history_lines[0] == 'orate Look, "There are newlines' |
| 1950 | assert history_lines[1] == " and spaces " |
| 1951 | assert history_lines[2] == ' "' |
| 1952 | assert history_lines[3] == " in" |
| 1953 | assert history_lines[4] == "quotes." |
| 1954 | assert history_lines[5] == ";" |
| 1955 | |
| 1956 | |
| 1957 | def test_multiline_complete_statement_eof(multiline_app, monkeypatch): |