feat: adopt marqdo 3.0.0-rc.4 public analysis boundary

This commit is contained in:
cflmy committed 2026-11-25 21:18:35 +08:00
1 parent 769550b14b
commit fe18df6c4b
74 files changed
+7618 -5368

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
#![allow(dead_code)]
use std::path::PathBuf;
use marqdo_lint::{
input::SourceDocument,
model::{ExecutionProjection, MarkdownTree},
};
pub fn fixture_path(name: &str) -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("tests/fixtures/rc4")
.join(name)
}
pub fn analysis_value(stem: &str) -> serde_json::Value {
serde_json::from_slice(&std::fs::read(fixture_path(&format!("{stem}.analysis.json"))).unwrap())
.unwrap()
}
pub fn projection(stem: &str) -> ExecutionProjection {
ExecutionProjection::from_json(analysis_value(stem)).unwrap()
}
pub fn document(stem: &str) -> SourceDocument {
let projection = projection(stem);
let module = projection.entry_module().unwrap().clone();
let source = module
.source_snapshot(fixture_path(&format!("{stem}.mq.md")))
.unwrap();
let markdown = MarkdownTree::from_analysis(
module.document.clone(),
&module.units,
&module.functions,
&source,
)
.unwrap();
SourceDocument {
source,
markdown,
module: Some(module),
}
}
pub fn require_core() -> Option<PathBuf> {
std::env::var_os("MARQDO_BIN").map(PathBuf::from)
}