mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 09:04:19 +01:00
Add test cases in python CLI tests for OFFSET on LIMIT clauses
This commit is contained in:
@@ -264,6 +264,32 @@ def test_update_with_limit():
|
|||||||
limbo.quit()
|
limbo.quit()
|
||||||
|
|
||||||
|
|
||||||
|
def test_update_with_limit_and_offset():
|
||||||
|
limbo = TestLimboShell(
|
||||||
|
"CREATE TABLE t (a,b,c); insert into t values (1,2,3), (4,5,6), (7,8,9), (1,2,3),(4,5,6), (7,8,9);"
|
||||||
|
)
|
||||||
|
limbo.run_test("update-limit-offset", "UPDATE t SET a = 10 LIMIT 1 OFFSET 3;", "")
|
||||||
|
limbo.run_test(
|
||||||
|
"update-limit-offset-result", "SELECT COUNT(*) from t WHERE a = 10;", "1"
|
||||||
|
)
|
||||||
|
limbo.run_test("update-limit-result", "SELECT a from t LIMIT 4;", "1\n4\n7\n10")
|
||||||
|
limbo.run_test(
|
||||||
|
"update-limit-offset-zero", "UPDATE t SET a = 100 LIMIT 0 OFFSET 0;", ""
|
||||||
|
)
|
||||||
|
limbo.run_test(
|
||||||
|
"update-limit-zero-result", "SELECT COUNT(*) from t WHERE a = 100;", "0"
|
||||||
|
)
|
||||||
|
limbo.run_test("update-limit-all", "UPDATE t SET a = 100 LIMIT -1 OFFSET 1;", "")
|
||||||
|
limbo.run_test("update-limit-result", "SELECT COUNT(*) from t WHERE a = 100;", "5")
|
||||||
|
limbo.run_test(
|
||||||
|
"udpate-limit-where", "UPDATE t SET a = 333 WHERE b = 5 LIMIT 1 OFFSET 2;", ""
|
||||||
|
)
|
||||||
|
limbo.run_test(
|
||||||
|
"update-limit-where-result", "SELECT COUNT(*) from t WHERE a = 333;", "0"
|
||||||
|
)
|
||||||
|
limbo.quit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Running all Limbo CLI tests...")
|
print("Running all Limbo CLI tests...")
|
||||||
test_basic_queries()
|
test_basic_queries()
|
||||||
@@ -282,4 +308,5 @@ if __name__ == "__main__":
|
|||||||
test_import_csv_skip()
|
test_import_csv_skip()
|
||||||
test_table_patterns()
|
test_table_patterns()
|
||||||
test_update_with_limit()
|
test_update_with_limit()
|
||||||
|
test_update_with_limit_and_offset()
|
||||||
print("All tests have passed")
|
print("All tests have passed")
|
||||||
|
|||||||
Reference in New Issue
Block a user