From 1833dcb618bffb79a0f90c9ea557e52145ca5277 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Mon, 16 Dec 2024 20:14:04 -0500 Subject: [PATCH] Shrink shell help msg and replace hardcoded path for shell tests --- Makefile | 2 +- cli/app.rs | 9 +-------- core/util.rs | 10 ++++++++++ testing/shelltests.py | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ee2f15e0d..096c0a679 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ test: limbo test-compat test-sqlite3 test-shell .PHONY: test test-shell: limbo - ./testing/shelltests.py + SQLITE_EXEC=$(SQLITE_EXEC) ./testing/shelltests.py .PHONY: test-shell test-compat: diff --git a/cli/app.rs b/cli/app.rs index c9f388af6..cd3e21eb9 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -646,7 +646,6 @@ fn get_io(db: &str) -> anyhow::Result> { const HELP_MSG: &str = r#" Limbo SQL Shell Help ============== - Welcome to the Limbo SQL Shell! You can execute any standard SQL command here. In addition to standard SQL commands, the following special commands are available: @@ -689,12 +688,6 @@ Usage Examples: 8. Show the current values of settings: .show -9. Set the value 'NULL' to be displayed for null values instead of empty string: - .nullvalue "NULL" - Note: ------ - All SQL commands must end with a semicolon (;). -- Special commands do not require a semicolon. - -"#; +- Special commands do not require a semicolon."#; diff --git a/core/util.rs b/core/util.rs index 985bfaa28..4b8a7f43b 100644 --- a/core/util.rs +++ b/core/util.rs @@ -217,6 +217,8 @@ pub fn exprs_are_equivalent(expr1: &Expr, expr2: &Expr) -> bool { _ => false, } } + (Expr::NotNull(expr1), Expr::NotNull(expr2)) => exprs_are_equivalent(expr1, expr2), + (Expr::IsNull(expr1), Expr::IsNull(expr2)) => exprs_are_equivalent(expr1, expr2), (Expr::Literal(lit1), Expr::Literal(lit2)) => check_literal_equivalency(lit1, lit2), (Expr::Id(id1), Expr::Id(id2)) => check_ident_equivalency(&id1.0, &id2.0), (Expr::Unary(op1, expr1), Expr::Unary(op2, expr2)) => { @@ -233,6 +235,14 @@ pub fn exprs_are_equivalent(expr1: &Expr, expr2: &Expr) -> bool { (Expr::Parenthesized(exprs1), exprs2) | (exprs2, Expr::Parenthesized(exprs1)) => { exprs1.len() == 1 && exprs_are_equivalent(&exprs1[0], exprs2) } + (Expr::Qualified(tn1, cn1), Expr::Qualified(tn2, cn2)) => { + check_ident_equivalency(&tn1.0, &tn2.0) && check_ident_equivalency(&cn1.0, &cn2.0) + } + (Expr::DoublyQualified(sn1, tn1, cn1), Expr::DoublyQualified(sn2, tn2, cn2)) => { + check_ident_equivalency(&sn1.0, &sn2.0) + && check_ident_equivalency(&tn1.0, &tn2.0) + && check_ident_equivalency(&cn1.0, &cn2.0) + } ( Expr::InList { lhs: lhs1, diff --git a/testing/shelltests.py b/testing/shelltests.py index 22c9ed122..f36972e25 100755 --- a/testing/shelltests.py +++ b/testing/shelltests.py @@ -3,7 +3,7 @@ import os import subprocess # Configuration -sqlite_exec = "./target/debug/limbo" +sqlite_exec = os.getenv("SQLITE_EXEC", "./target/debug/limbo") cwd = os.getcwd() # Initial setup commands