Reduce macro copying during native suffix convergence

This commit is contained in:
gloamxun committed 2026-12-01 22:50:53 +08:00
1 parent 57c05d9635
commit c008c52964
9 files changed
+228 -110

No files matched your search

@@ -1,6 +1,6 @@
//! Failed observations are retained without publishing or claiming a checkpoint.
use sha2::{Digest, Sha256};
use std::cell::RefCell;
use std::{cell::RefCell, sync::Arc};
use texrra_tex_core::{execution::*, resources::ResourceTrace};
fn source(name: &str, text: &str) -> SourceFile {
@@ -52,7 +52,7 @@ fn failed_child_macro_keeps_actual_versions_meanings_events_and_state_boundary()
);
assert_eq!(host.messages, ["BEFORE"]);
let e = &failure.evidence;
assert_eq!(e.sources, [main, child]);
assert_eq!(e.sources, [Arc::new(main), Arc::new(child)]);
for (s, v) in e.sources.iter().zip(&e.source_versions) {
assert_eq!(v.sha256, format!("{:x}", Sha256::digest(&s.data)));
assert_eq!(v.bytes, s.data.len() as u64);
@@ -102,7 +102,7 @@ fn cancellation_preserves_observed_progress_but_prestart_does_not_invent_input()
};
let failure = run().run_detailed(main.clone(), &mut host).unwrap_err();
assert!(failure.error.message.contains("cancelled"));
assert_eq!(failure.evidence.sources, [main.clone()]);
assert_eq!(failure.evidence.sources, [Arc::new(main.clone())]);
assert!(failure.evidence.reads.contains(&Dependency::Source(0)));
assert_eq!(host.messages, ["FIRST"]);
let before = run().run_detailed(main, &mut host).unwrap_err();
@@ -145,6 +145,7 @@ fn superseding_after_core_completion_retains_result_without_publishing_it() {
.start()
.run(executor(), source("old.tex", r"\count0=1\end"), &mut host)
.unwrap();
assert_eq!(previous.execution_resources, Some(host.trace.clone()));
host.armed = true;
let failure = session
.start()
@@ -156,6 +157,7 @@ fn superseding_after_core_completion_retains_result_without_publishing_it() {
assert_eq!(completed.execution.state.count(0), 2);
assert_eq!(completed.revision, failure.revision);
assert_eq!(failure.resources, Some(host.trace.clone()));
assert_eq!(completed.execution_resources, failure.resources);
assert_eq!(session.latest().unwrap().revision, previous.revision);
assert!(host.pending.borrow().as_ref().unwrap().revision() > completed.revision);
host.pending.borrow_mut().take();
@@ -165,6 +167,7 @@ fn superseding_after_core_completion_retains_result_without_publishing_it() {
.unwrap_err();
assert!(matches!(interrupted.error, RevisionError::Cancelled));
assert!(interrupted.completed_execution.is_none());
assert_eq!(interrupted.resources, Some(host.trace.clone()));
assert!(
interrupted
.failed_execution