style: format the whole tree with cargo fmt (stock defaults, #35)
One-time, mechanical reformat — no functional changes. The tree was not rustfmt-clean (~1800 hunks across ~100 files); this brings it to stock `cargo fmt` defaults so a `cargo fmt --check` CI gate can follow. Behaviour-preserving: 2509 pass / 0 fail / 1 ignored (unchanged baseline), clippy clean. A .git-blame-ignore-revs entry follows so `git blame` skips this commit.
This commit is contained in:
+39
-59
@@ -57,11 +57,13 @@ fn advanced_mode_select_dispatches_as_command_select() {
|
||||
type_str(&mut app, "select 1");
|
||||
let actions = submit(&mut app);
|
||||
match actions.as_slice() {
|
||||
[Action::ExecuteDsl {
|
||||
command: Command::Select { sql },
|
||||
source,
|
||||
..
|
||||
}] => {
|
||||
[
|
||||
Action::ExecuteDsl {
|
||||
command: Command::Select { sql },
|
||||
source,
|
||||
..
|
||||
},
|
||||
] => {
|
||||
assert!(
|
||||
sql.contains("select 1"),
|
||||
"Command::Select carries the validated SQL text: {sql:?}",
|
||||
@@ -118,10 +120,12 @@ fn colon_one_shot_from_simple_mode_dispatches_select() {
|
||||
// Persistent mode is unchanged.
|
||||
assert_eq!(app.mode, Mode::Simple);
|
||||
match actions.as_slice() {
|
||||
[Action::ExecuteDsl {
|
||||
command: Command::Select { sql },
|
||||
..
|
||||
}] => {
|
||||
[
|
||||
Action::ExecuteDsl {
|
||||
command: Command::Select { sql },
|
||||
..
|
||||
},
|
||||
] => {
|
||||
assert!(
|
||||
sql.contains("select 1") && !sql.starts_with(':'),
|
||||
"the `:` is stripped before the SQL is queued: {sql:?}",
|
||||
@@ -167,8 +171,7 @@ fn rt() -> tokio::runtime::Runtime {
|
||||
|
||||
fn open_project_db() -> (project::Project, Database, tempfile::TempDir) {
|
||||
let dir = tempfile::tempdir().expect("create tempdir");
|
||||
let project =
|
||||
project::open_or_create(None, Some(dir.path())).expect("open or create project");
|
||||
let project = project::open_or_create(None, Some(dir.path())).expect("open or create project");
|
||||
let persistence = Persistence::new(project.path().to_path_buf());
|
||||
let db = Database::open_with_persistence(project.db_path(), persistence)
|
||||
.expect("open db with persistence");
|
||||
@@ -315,22 +318,12 @@ fn database_run_select_recovers_bool_column_type() {
|
||||
)
|
||||
.await
|
||||
.expect("create table");
|
||||
db.insert(
|
||||
"Products".to_string(),
|
||||
None,
|
||||
vec![Value::Bool(true)],
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect("insert row");
|
||||
db.insert(
|
||||
"Products".to_string(),
|
||||
None,
|
||||
vec![Value::Bool(false)],
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect("insert row");
|
||||
db.insert("Products".to_string(), None, vec![Value::Bool(true)], None)
|
||||
.await
|
||||
.expect("insert row");
|
||||
db.insert("Products".to_string(), None, vec![Value::Bool(false)], None)
|
||||
.await
|
||||
.expect("insert row");
|
||||
});
|
||||
let data = rt
|
||||
.block_on(db.run_select("select Active from Products".to_string()))
|
||||
@@ -370,9 +363,7 @@ fn database_run_select_recovers_text_type_through_alias() {
|
||||
// origin metadata still points at `Users.Name`, so the
|
||||
// playground type is recovered.
|
||||
let data = rt
|
||||
.block_on(
|
||||
db.run_select("select Name as n from Users".to_string()),
|
||||
)
|
||||
.block_on(db.run_select("select Name as n from Users".to_string()))
|
||||
.expect("SELECT runs");
|
||||
assert_eq!(data.columns, vec!["n".to_string()]);
|
||||
assert_eq!(data.column_types, vec![Some(Type::Text)]);
|
||||
@@ -394,9 +385,14 @@ fn database_run_select_computed_expression_stays_typeless() {
|
||||
)
|
||||
.await
|
||||
.expect("create table");
|
||||
db.insert("T".to_string(), None, vec![Value::Number("5".to_string())], None)
|
||||
.await
|
||||
.expect("insert");
|
||||
db.insert(
|
||||
"T".to_string(),
|
||||
None,
|
||||
vec![Value::Number("5".to_string())],
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect("insert");
|
||||
});
|
||||
let data = rt
|
||||
.block_on(db.run_select("select Score + 1 from T".to_string()))
|
||||
@@ -434,17 +430,12 @@ fn engine_aggregate_in_where_routes_through_catalog() {
|
||||
// ADR-0032 §11.4. Run the bad query and confirm the
|
||||
// friendly layer routes the message through engine.aggregate_misuse.
|
||||
let err = rt
|
||||
.block_on(db.run_select(
|
||||
"select id from T where count(score) > 0".to_string(),
|
||||
))
|
||||
.block_on(db.run_select("select id from T where count(score) > 0".to_string()))
|
||||
.expect_err("engine should reject aggregate in WHERE");
|
||||
let DbError::Sqlite { .. } = &err else {
|
||||
panic!("expected Sqlite engine error; got {err:?}");
|
||||
};
|
||||
let friendly = friendly::translate_error(
|
||||
&err,
|
||||
&friendly::TranslateContext::default(),
|
||||
);
|
||||
let friendly = friendly::translate_error(&err, &friendly::TranslateContext::default());
|
||||
let rendered = friendly.render();
|
||||
assert!(
|
||||
rendered.contains("aggregate"),
|
||||
@@ -506,23 +497,17 @@ fn engine_group_by_missing_routes_through_catalog() {
|
||||
// false-positive on phrasings that happen to contain
|
||||
// "group by" elsewhere. Any successful query is fine.
|
||||
let _ = rt
|
||||
.block_on(db.run_select(
|
||||
"select category, count(*) from T group by category".to_string(),
|
||||
))
|
||||
.block_on(db.run_select("select category, count(*) from T group by category".to_string()))
|
||||
.expect("benign GROUP BY query runs");
|
||||
// Direct unit test on the matcher: ensure a message that
|
||||
// mentions GROUP BY routes through the catalog.
|
||||
let synthetic = DbError::Sqlite {
|
||||
message:
|
||||
"column must appear in the GROUP BY clause or be used in an aggregate function"
|
||||
.to_string(),
|
||||
message: "column must appear in the GROUP BY clause or be used in an aggregate function"
|
||||
.to_string(),
|
||||
kind: rdbms_playground::db::SqliteErrorKind::Other,
|
||||
};
|
||||
let rendered = friendly::translate_error(
|
||||
&synthetic,
|
||||
&friendly::TranslateContext::default(),
|
||||
)
|
||||
.render();
|
||||
let rendered =
|
||||
friendly::translate_error(&synthetic, &friendly::TranslateContext::default()).render();
|
||||
assert!(
|
||||
rendered.contains("GROUP BY"),
|
||||
"engine.group_by_required wording missing; got {rendered:?}",
|
||||
@@ -567,19 +552,14 @@ fn engine_scalar_subquery_too_many_rows_routes_through_catalog() {
|
||||
// catalog (the matcher would fire if SQLite ever
|
||||
// surfaced this verbatim).
|
||||
let _ = rt
|
||||
.block_on(db.run_select(
|
||||
"select (select v from T) from T".to_string(),
|
||||
))
|
||||
.block_on(db.run_select("select (select v from T) from T".to_string()))
|
||||
.expect("benign scalar subquery query runs");
|
||||
let synthetic = DbError::Sqlite {
|
||||
message: "scalar subquery returned more than one row".to_string(),
|
||||
kind: rdbms_playground::db::SqliteErrorKind::Other,
|
||||
};
|
||||
let rendered = friendly::translate_error(
|
||||
&synthetic,
|
||||
&friendly::TranslateContext::default(),
|
||||
)
|
||||
.render();
|
||||
let rendered =
|
||||
friendly::translate_error(&synthetic, &friendly::TranslateContext::default()).render();
|
||||
assert!(
|
||||
rendered.contains("more than one row"),
|
||||
"engine.scalar_subquery_too_many_rows wording missing; got {rendered:?}",
|
||||
|
||||
Reference in New Issue
Block a user