Matrix: create table, DDL, and app-command coverage
55 tests covering create table, drop column, drop relationship (endpoints + by-name), add relationship, rename/change column, and all app-lifecycle commands. The drop-column and relationship tests drove the §2.2 writes_table fix in the previous commit. Documents one UX wrinkle as a flagged finding: partial entry words (`qu`) classify as DefiniteErrorAt — same as unknown commands — because the walker only engages on a complete entry word. 859 baseline -> 989 passing; 1 ignored (pre-existing doc-test).
This commit is contained in:
@@ -1 +1,72 @@
|
||||
//! Submodule stub — populated in subsequent tasks.
|
||||
//! Matrix coverage for `drop column [from] [table] <T> : <col>`
|
||||
//! (ADR-0013).
|
||||
//!
|
||||
//! Handoff-12 §2.2 flagged that the DDL `TABLE_NAME_EXISTING`
|
||||
//! slot didn't set `writes_table`, so at `drop column from T: `
|
||||
//! the column-name slot couldn't narrow to T's columns —
|
||||
//! candidates leaked from every table. This file asserts the
|
||||
//! per-table narrowing; the fix lands alongside it.
|
||||
|
||||
use crate::typing_surface::*;
|
||||
use rdbms_playground::input_render::InputState;
|
||||
|
||||
#[test]
|
||||
fn after_drop_column_offers_table_names() {
|
||||
let schema = schema_multi_table();
|
||||
let a = assess_at_end("drop column from ", &schema);
|
||||
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
||||
assert_candidate_present(&a, &["Customers", "Orders"]);
|
||||
crate::snap!("after_from", a);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn after_table_name_expects_colon() {
|
||||
let schema = schema_serial_pk();
|
||||
let a = assess_at_end("drop column from Customers", &schema);
|
||||
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
||||
crate::snap!("after_table_name", a);
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// Handoff §2.2 — column slot narrows to the active table.
|
||||
// =========================================================
|
||||
|
||||
#[test]
|
||||
fn after_colon_offers_only_active_table_columns_no_leakage() {
|
||||
let schema = schema_multi_table();
|
||||
let a = assess_at_end("drop column from Customers: ", &schema);
|
||||
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
||||
// Customers's columns must be offered.
|
||||
assert_candidate_present(&a, &["id", "Name"]);
|
||||
// Orders's columns must NOT leak.
|
||||
assert_no_candidate_named(&a, &["OrderId", "CustId", "Total"]);
|
||||
crate::snap!("after_colon_multi_table", a);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn after_colon_serial_pk_offers_all_columns() {
|
||||
let schema = schema_serial_pk();
|
||||
let a = assess_at_end("drop column from Customers: ", &schema);
|
||||
assert_candidate_present(&a, &["id", "Name", "Email"]);
|
||||
crate::snap!("after_colon_serial_pk", a);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_drop_column_parses() {
|
||||
let schema = schema_serial_pk();
|
||||
let a = assess_at_end("drop column from Customers: Email", &schema);
|
||||
assert!(matches!(a.state, InputState::Valid));
|
||||
assert_eq!(a.parse_result.as_deref(), Ok("DropColumn"));
|
||||
crate::snap!("complete_drop_column", a);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drop_column_with_table_keyword_parses() {
|
||||
let schema = schema_serial_pk();
|
||||
let a = assess_at_end(
|
||||
"drop column from table Customers: Email",
|
||||
&schema,
|
||||
);
|
||||
assert!(matches!(a.state, InputState::Valid));
|
||||
crate::snap!("with_table_keyword", a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user