37db2f5dd2
34 new tests covering: - Form C bare-value-list (happy path + Form-A-recovery + type-unaware grammar limitation per handoff §2.2) - update with WHERE (column-narrowing invariant per handoff §1 bug E1; typed-slot prose for assignments and where filters) - update --all-rows (filter-clause requirement per ADR-0014) - delete with WHERE (column-narrowing; typed-slot prose for where filters) - delete --all-rows 859 baseline -> 931 passing. No bugs surfaced — the data-mutation command family was already well-shaped post-Phase-D.
55 lines
1.6 KiB
Rust
55 lines
1.6 KiB
Rust
//! Matrix coverage for `update T set col=val --all-rows`
|
|
//! (ADR-0014 opt-in for unfiltered updates).
|
|
|
|
use crate::typing_surface::*;
|
|
use rdbms_playground::input_render::InputState;
|
|
|
|
#[test]
|
|
fn before_all_rows_flag_is_incomplete() {
|
|
let schema = schema_serial_pk();
|
|
let a = assess_at_end(
|
|
"update Customers set Email='x' ",
|
|
&schema,
|
|
);
|
|
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
|
// Both `where` and `--all-rows` are valid continuations.
|
|
assert_candidate_present(&a, &["--all-rows"]);
|
|
crate::snap!("before_all_rows", a);
|
|
}
|
|
|
|
#[test]
|
|
fn complete_update_all_rows_parses() {
|
|
let schema = schema_serial_pk();
|
|
let a = assess_at_end(
|
|
"update Customers set Email='new@b.c' --all-rows",
|
|
&schema,
|
|
);
|
|
assert!(matches!(a.state, InputState::Valid));
|
|
assert_eq!(a.parse_result.as_deref(), Ok("Update"));
|
|
crate::snap!("complete_all_rows", a);
|
|
}
|
|
|
|
#[test]
|
|
fn update_without_filter_clause_is_incomplete() {
|
|
// Per ADR-0014, update requires WHERE or --all-rows.
|
|
let schema = schema_serial_pk();
|
|
let a = assess_at_end(
|
|
"update Customers set Email='new@b.c'",
|
|
&schema,
|
|
);
|
|
assert!(matches!(a.state, InputState::IncompleteAtEof));
|
|
crate::snap!("no_filter_clause", a);
|
|
}
|
|
|
|
#[test]
|
|
fn update_partial_flag_name_is_incomplete() {
|
|
let schema = schema_serial_pk();
|
|
let a = assess_at_end(
|
|
"update Customers set Email='x' --all",
|
|
&schema,
|
|
);
|
|
// Partial flag still in progress.
|
|
assert!(!matches!(a.state, InputState::Valid));
|
|
crate::snap!("partial_flag", a);
|
|
}
|