ADR-0027: existing-cases sweep + docs (step F)
Sweep: input_verdict tests confirm the schema-existence check fires across the identifier-taking commands — unknown table on drop / show / add column, unknown column on drop column / update — and that known references stay clean. The Step B check is grammar-generic, so this is verification + coverage rather than new code. Docs: requirements.md S6 -> [x], baseline 1096; CLAUDE.md deferred list reconciled (C5a and S6 are done — removed); ADR-0026's as-built note updated (step 5 shipped via ADR-0027); ADR-0027 gains an As-built notes section recording the post-walk diagnostics realization, the pre-rendered message, the timeout-based debounce, coarse WARNING spans, and the deferred highlight/hint wiring.
This commit is contained in:
@@ -1679,6 +1679,63 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
// ---- Existing-cases sweep (ADR-0027 §6) -------------------
|
||||
|
||||
#[test]
|
||||
fn input_verdict_sweep_unknown_table_across_commands() {
|
||||
let schema = schema_with("Customers", &[("id", Type::Int)]);
|
||||
for input in [
|
||||
"drop table NoSuchTable",
|
||||
"show table NoSuchTable",
|
||||
"show data NoSuchTable",
|
||||
"add column to NoSuchTable: x (int)",
|
||||
] {
|
||||
assert_eq!(
|
||||
super::input_verdict(input, Some(&schema)),
|
||||
Some(super::Severity::Error),
|
||||
"unknown table in {input:?} should be flagged",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn input_verdict_sweep_unknown_column_across_commands() {
|
||||
let schema = schema_with(
|
||||
"Customers",
|
||||
&[("id", Type::Int), ("Name", Type::Text)],
|
||||
);
|
||||
for input in [
|
||||
"drop column from table Customers: NoSuchCol",
|
||||
"update Customers set NoSuchCol = 1 where id = 1",
|
||||
] {
|
||||
assert_eq!(
|
||||
super::input_verdict(input, Some(&schema)),
|
||||
Some(super::Severity::Error),
|
||||
"unknown column in {input:?} should be flagged",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn input_verdict_known_entities_across_commands_are_clean() {
|
||||
let schema = schema_with(
|
||||
"Customers",
|
||||
&[("id", Type::Int), ("Name", Type::Text)],
|
||||
);
|
||||
for input in [
|
||||
"show table Customers",
|
||||
"drop table Customers",
|
||||
"add column to Customers: Email (text)",
|
||||
"drop column from table Customers: Name",
|
||||
] {
|
||||
assert_eq!(
|
||||
super::input_verdict(input, Some(&schema)),
|
||||
None,
|
||||
"{input:?} references only known entities — clean",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn walker_parses_insert_with_explicit_column_list() {
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user