fix(anatomy): R5.3 non-object children refused at add, reads confined to the seed, array length in the shape check, only run-created folders, seed guard tested in place
This commit is contained in:
1 parent
42bbc48fcc
commit
86273b6206
6 files changed
+149
-21
No files matched your search
@@ -309,7 +309,10 @@ fn synthetic_seed(document_json: &str) -> String {
|
||||
}
|
||||
|
||||
/// Cases the TypeScript accepted and the port refuses, declared in RUST.md §11.12.
|
||||
const DECLARED_REFUSALS: [&str; 1] = ["declared-set-without-value-drops-key"];
|
||||
const DECLARED_REFUSALS: [&str; 2] = [
|
||||
"declared-set-without-value-drops-key",
|
||||
"declared-children-string-renamed-then-removed",
|
||||
];
|
||||
|
||||
/// Cases the TypeScript refused and the port accepts, declared in RUST.md §11.12 (checked by
|
||||
/// `an_inherited_member_name_is_a_plain_key_and_bypasses_nothing`).
|
||||
@@ -331,6 +334,14 @@ fn has_set_without_value(changes_file: &Value) -> bool {
|
||||
/// Declared family: an inherited `Object.prototype` member read at the end of a field path
|
||||
/// made `structuredClone` throw at the op; the port writes a plain key the shape gate refuses.
|
||||
fn assert_same_refusal(name: &str, typescript: &str, rust: &str) {
|
||||
// Declared family: a non-object child of an added item made the TypeScript throw a
|
||||
// TypeError where it walked it; the port refuses it at the add.
|
||||
if typescript.contains("Cannot read properties of")
|
||||
|| typescript.contains("Cannot create property")
|
||||
{
|
||||
assert!(rust.contains("that is not an object"), "{name}: {rust}");
|
||||
return;
|
||||
}
|
||||
if typescript.ends_with("could not be cloned.") {
|
||||
assert!(
|
||||
rust.starts_with("curated document is not shape-valid"),
|
||||
@@ -374,7 +385,12 @@ fn the_synthetic_cases_match_the_typescript_or_are_refused_alike() {
|
||||
let error = outcome
|
||||
.err()
|
||||
.unwrap_or_else(|| panic!("{name}: the TypeScript refused, the port accepted"));
|
||||
if has_set_without_value(&case["changes_file"]) {
|
||||
if name == "declared-children-string-renamed-then-removed" {
|
||||
assert!(
|
||||
error.to_string().contains("that is not an object"),
|
||||
"{name}"
|
||||
);
|
||||
} else if has_set_without_value(&case["changes_file"]) {
|
||||
// The declared family: refused at parse, whatever the TypeScript made of it.
|
||||
assert!(
|
||||
error.to_string().contains("missing field `value`"),
|
||||
@@ -422,7 +438,7 @@ fn the_synthetic_cases_match_the_typescript_or_are_refused_alike() {
|
||||
"{name} seed"
|
||||
);
|
||||
}
|
||||
assert_eq!((compared, refused), (11, 62));
|
||||
assert_eq!((compared, refused), (11, 65));
|
||||
let reference_cases = frozen["reference_cases"].as_array().unwrap();
|
||||
assert_eq!(reference_cases.len(), 7);
|
||||
for case in reference_cases {
|
||||
|
||||
Reference in new issue
Block a user