Correct accepted-output warning oracles

This commit is contained in:
2026-09-24 20:04:15 -07:00
parent 4872141c03
commit edf096cd33
2 changed files with 74 additions and 8 deletions
@@ -509,16 +509,36 @@ fn rich_oa_sa_swaps_unicode_crlf_complete_actual_bytes_and_models() {
.unwrap();
assert_eq!(accepted.bundle(), &expected);
assert_eq!(accepted.project(), &rich_desired(layer));
assert!(accepted.warnings().is_empty());
let (span, line) = if unicode {
(
Span {
start: 351,
end: 416,
},
7,
)
} else {
(
Span {
start: 338,
end: 403,
},
6,
)
};
assert_eq!(
accepted.warnings(),
leaf_work_warnings("main.arcadia", span, line)
);
assert_eq!(
accepted.retained(),
Slots {
entries: 3,
entries: 5,
occurrences: 0,
text: if unicode {
unicode_bytes + 42
unicode_bytes + 42 + 227
} else {
bytes + 42
bytes + 42 + 227
}
}
);
@@ -527,6 +547,21 @@ fn rich_oa_sa_swaps_unicode_crlf_complete_actual_bytes_and_models() {
}
}
}
fn leaf_work_warnings(path: &str, span: Span, line: usize) -> [SourceDiagnostic; 2] {
// Allocation validation precedes advisory coverage. Both locate the complete
// ordinary Work declaration; neither fixture supplies allocation or context.
[
("unallocated_leaf", Some("allocation"), "Allocate leaf 'Work' to a performer."),
("work_without_behavior_context", None, "Include this leaf activity/function in a process/chain or scenario through a work action or exchange occurrence."),
].map(|(code, field, message)| SourceDiagnostic {
path: path.into(), related: Vec::new(),
diagnostic: language::Diagnostic {
severity: validation::Severity::Warning, code: code.into(),
object_id: Some(id(2)), field: field.map(str::to_owned),
message: message.into(), span, line, column: 1,
},
})
}
fn calculation(p: &mut Project) -> &mut a::CalculationDefinition {
let a::DefinitionBody::Calculation(c) = &mut p.definitions.get_mut(&id(2)).unwrap().body else {
panic!("calculation")
@@ -794,14 +829,17 @@ fn four_file_cross_family_swap_preserves_entire_untouched_file_and_comments() {
.unwrap();
let pending = pending.verify().unwrap();
assert_eq!(pending.project(), &desired);
assert!(pending.warnings().is_empty());
assert_eq!(
pending.warnings(),
leaf_work_warnings("b.arcadia", Span { start: 25, end: 90 }, 2)
);
assert_eq!(pending.bundle, expected);
assert_eq!(
pending.retained,
Slots {
entries: 4,
entries: 6,
occurrences: 0,
text: 526
text: 526 + 221
}
);
}