(temp_db, key, history_path, mode)
| 72 | ) |
| 73 | @pytest.mark.parametrize("mode", [":multiline\n", ":singleline\n"]) |
| 74 | def test_enter(temp_db, key, history_path, mode) -> None: |
| 75 | test = ( |
| 76 | ShellTest().add_argument(temp_db).add_argument("-p").add_argument(history_path) |
| 77 | ) |
| 78 | test.start() |
| 79 | test.send_finished_statement(mode) |
| 80 | test.send_statement('RETURN "databases rule" AS a;') |
| 81 | test.send_finished_statement(key) |
| 82 | assert ( |
| 83 | test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF]) |
| 84 | == 0 |
| 85 | ) |
| 86 | assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 0 |
| 87 | |
| 88 | with open(os.path.join(history_path, "history.txt")) as f: |
| 89 | assert f.readline() == mode |
| 90 | assert f.readline() == 'RETURN "databases rule" AS a;\n' |
| 91 | deleteIfExists(os.path.join(history_path, "history.txt")) |
| 92 | |
| 93 | # enter in multiline when not at the end of the line should not execute the query |
| 94 | test = ( |
| 95 | ShellTest().add_argument(temp_db).add_argument("-p").add_argument(history_path) |
| 96 | ) |
| 97 | test.start() |
| 98 | test.send_finished_statement(mode) |
| 99 | test.send_statement('RETURN "databases rule" AS a;\x1b[D\x1b[D\x1b[D') |
| 100 | test.send_finished_statement(key) |
| 101 | assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 0 |
| 102 | |
| 103 | with open(os.path.join(history_path, "history.txt")) as f: |
| 104 | assert f.readline() == mode |
| 105 | assert f.readline() != 'RETURN "databases rule" AS a;\n' |
| 106 | deleteIfExists(os.path.join(history_path, "history.txt")) |
| 107 | |
| 108 | |
| 109 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected