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:
+43
-27
@@ -17,7 +17,7 @@ use rdbms_playground::action::Action;
|
||||
use rdbms_playground::app::App;
|
||||
use rdbms_playground::db::Database;
|
||||
use rdbms_playground::dsl::{
|
||||
parse_command, ColumnSpec, Command, ReferentialAction, ShowListKind, Type,
|
||||
ColumnSpec, Command, ReferentialAction, ShowListKind, Type, parse_command,
|
||||
};
|
||||
use rdbms_playground::event::AppEvent;
|
||||
use rdbms_playground::mode::Mode;
|
||||
@@ -108,8 +108,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");
|
||||
@@ -195,8 +194,7 @@ fn show_relationships_lists_name_endpoints_and_nondefault_action() {
|
||||
// Name, both endpoints, and the non-default ON DELETE CASCADE
|
||||
// (ON UPDATE NO ACTION is the default and is omitted).
|
||||
assert_eq!(
|
||||
lines[1],
|
||||
" orders_customer: Customers.id → Orders.customer_id on delete cascade",
|
||||
lines[1], " orders_customer: Customers.id → Orders.customer_id on delete cascade",
|
||||
"relationship summary line: {lines:?}",
|
||||
);
|
||||
}
|
||||
@@ -222,7 +220,8 @@ fn show_lists_report_empty_collections_with_friendly_lines() {
|
||||
let rt = rt();
|
||||
// No schema seeded — every kind is empty.
|
||||
assert_eq!(
|
||||
rt.block_on(db.show_list(ShowListKind::Tables, None)).unwrap(),
|
||||
rt.block_on(db.show_list(ShowListKind::Tables, None))
|
||||
.unwrap(),
|
||||
vec!["No tables in this project yet.".to_string()],
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -231,7 +230,8 @@ fn show_lists_report_empty_collections_with_friendly_lines() {
|
||||
vec!["No relationships in this project yet.".to_string()],
|
||||
);
|
||||
assert_eq!(
|
||||
rt.block_on(db.show_list(ShowListKind::Indexes, None)).unwrap(),
|
||||
rt.block_on(db.show_list(ShowListKind::Indexes, None))
|
||||
.unwrap(),
|
||||
vec!["No indexes in this project yet.".to_string()],
|
||||
);
|
||||
}
|
||||
@@ -246,7 +246,10 @@ fn show_one_relationship_renders_detail_block() {
|
||||
let rt = rt();
|
||||
rt.block_on(seed_schema(&db));
|
||||
let lines = rt
|
||||
.block_on(db.show_list(ShowListKind::Relationships, Some("orders_customer".to_string())))
|
||||
.block_on(db.show_list(
|
||||
ShowListKind::Relationships,
|
||||
Some("orders_customer".to_string()),
|
||||
))
|
||||
.expect("show relationship");
|
||||
assert_eq!(lines[0], "Relationship `orders_customer`:");
|
||||
assert_eq!(lines[1], " Customers.id → Orders.customer_id");
|
||||
@@ -262,7 +265,10 @@ fn show_one_index_renders_detail_block() {
|
||||
let rt = rt();
|
||||
rt.block_on(seed_schema(&db));
|
||||
let lines = rt
|
||||
.block_on(db.show_list(ShowListKind::Indexes, Some("idx_orders_customer".to_string())))
|
||||
.block_on(db.show_list(
|
||||
ShowListKind::Indexes,
|
||||
Some("idx_orders_customer".to_string()),
|
||||
))
|
||||
.expect("show index");
|
||||
assert_eq!(lines[0], "Index `idx_orders_customer` on Orders:");
|
||||
assert!(
|
||||
@@ -329,7 +335,10 @@ fn app_show_tables_dispatches_show_list_command() {
|
||||
}
|
||||
)
|
||||
});
|
||||
assert!(dispatched, "submit dispatches ShowList(Tables): {actions:?}");
|
||||
assert!(
|
||||
dispatched,
|
||||
"submit dispatches ShowList(Tables): {actions:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -337,10 +346,11 @@ fn app_renders_show_list_lines_as_system_output() {
|
||||
// Feed the success event directly so the test stays
|
||||
// self-contained (the worker round-trip is covered above).
|
||||
let mut app = App::new();
|
||||
app.output.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show tables",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.output
|
||||
.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show tables",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.update(AppEvent::DslShowListSucceeded {
|
||||
command: Command::ShowList {
|
||||
kind: ShowListKind::Tables,
|
||||
@@ -403,10 +413,11 @@ fn app_renders_show_relationship_as_a_styled_diagram() {
|
||||
.expect("found");
|
||||
|
||||
let mut app = App::new();
|
||||
app.output.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show relationship orders_customer",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.output
|
||||
.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show relationship orders_customer",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.update(AppEvent::DslShowRelationshipSucceeded {
|
||||
command: Command::ShowList {
|
||||
kind: ShowListKind::Relationships,
|
||||
@@ -423,7 +434,10 @@ fn app_renders_show_relationship_as_a_styled_diagram() {
|
||||
// Both tables, box-drawing, the connector arrow, the actions line.
|
||||
assert!(text.contains("Orders"), "child box: {text}");
|
||||
assert!(text.contains("Customers"), "parent box: {text}");
|
||||
assert!(text.contains('┌') && text.contains('│'), "box drawing: {text}");
|
||||
assert!(
|
||||
text.contains('┌') && text.contains('│'),
|
||||
"box drawing: {text}"
|
||||
);
|
||||
assert!(text.contains('▶'), "connector arrow: {text}");
|
||||
assert!(text.contains("on delete cascade"), "actions: {text}");
|
||||
// The diagram lines are styled (per-span runs), not plain system.
|
||||
@@ -436,10 +450,11 @@ fn app_renders_show_relationship_as_a_styled_diagram() {
|
||||
#[test]
|
||||
fn app_show_relationship_not_found_shows_friendly_line() {
|
||||
let mut app = App::new();
|
||||
app.output.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show relationship nope",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.output
|
||||
.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show relationship nope",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.update(AppEvent::DslShowRelationshipSucceeded {
|
||||
command: Command::ShowList {
|
||||
kind: ShowListKind::Relationships,
|
||||
@@ -466,10 +481,11 @@ fn app_show_table_renders_relationships_as_compact_diagrams() {
|
||||
.expect("describe Orders");
|
||||
|
||||
let mut app = App::new();
|
||||
app.output.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show table Orders",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.output
|
||||
.push_back(rdbms_playground::app::OutputLine::echo(
|
||||
"show table Orders",
|
||||
Mode::Simple,
|
||||
));
|
||||
app.update(AppEvent::DslSucceeded {
|
||||
command: Command::ShowTable {
|
||||
name: "Orders".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user