mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
adjust stack_offset for test_limbo_cli
This commit is contained in:
parent
4c0bd50ac9
commit
321def3c30
1 changed files with 12 additions and 9 deletions
|
@ -75,11 +75,14 @@ class LimboShell:
|
|||
|
||||
def _handle_error(self) -> bool:
|
||||
while True:
|
||||
error_output = self.pipe.stderr.read(PIPE_BUF)
|
||||
if error_output == b"":
|
||||
return True
|
||||
console.error(error_output.decode(), end="")
|
||||
return False
|
||||
ready, _, errors = select.select(
|
||||
[self.pipe.stderr], [], [self.pipe.stderr], 0
|
||||
)
|
||||
if not (ready + errors):
|
||||
break
|
||||
error_output = self.pipe.stderr.read(PIPE_BUF).decode()
|
||||
console.error(error_output, end="", _stack_offset=2)
|
||||
raise RuntimeError("Error encountered in Limbo shell.")
|
||||
|
||||
@staticmethod
|
||||
def _clean_output(output: str, marker: str) -> str:
|
||||
|
@ -129,7 +132,7 @@ INSERT INTO t VALUES (zeroblob(1024 - 1), zeroblob(1024 - 2), zeroblob(1024 - 3)
|
|||
self.shell.quit()
|
||||
|
||||
def run_test(self, name: str, sql: str, expected: str) -> None:
|
||||
console.info(f"Running test: {name}")
|
||||
console.info(f"Running test: {name}", _stack_offset=2)
|
||||
actual = self.shell.execute(sql)
|
||||
assert actual == expected, (
|
||||
f"Test failed: {name}\n"
|
||||
|
@ -139,9 +142,9 @@ INSERT INTO t VALUES (zeroblob(1024 - 1), zeroblob(1024 - 2), zeroblob(1024 - 3)
|
|||
)
|
||||
|
||||
def debug_print(self, sql: str):
|
||||
console.debug(f"debugging: {sql}")
|
||||
console.debug(f"debugging: {sql}", _stack_offset=2)
|
||||
actual = self.shell.execute(sql)
|
||||
console.debug(f"OUTPUT:\n{repr(actual)}")
|
||||
console.debug(f"OUTPUT:\n{repr(actual)}", _stack_offset=2)
|
||||
|
||||
def run_test_fn(
|
||||
self, sql: str, validate: Callable[[str], bool], desc: str = ""
|
||||
|
@ -149,7 +152,7 @@ INSERT INTO t VALUES (zeroblob(1024 - 1), zeroblob(1024 - 2), zeroblob(1024 - 3)
|
|||
# Print the test that is executing before executing the sql command
|
||||
# Printing later confuses the user of the code what test has actually failed
|
||||
if desc:
|
||||
console.info(f"Testing: {desc}")
|
||||
console.info(f"Testing: {desc}", _stack_offset=2)
|
||||
actual = self.shell.execute(sql)
|
||||
assert validate(actual), f"Test failed\nSQL: {sql}\nActual:\n{repr(actual)}"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue