Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
@@ -1429,44 +1429,15 @@ fn m05_skill_front_has_occlusion_core_not_classic_index() {
|
||||
"{rel} still teaches the inverted marker polarity"
|
||||
);
|
||||
}
|
||||
let skill = std::fs::read_to_string(root.join("skills/marqdo/SKILL.md")).unwrap();
|
||||
let golden = fence_after(&skill, "## Call one function");
|
||||
let dir = std::env::temp_dir().join(format!("mq-skill-call-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let file = dir.join("calculator.mq.md");
|
||||
std::fs::write(&file, golden).unwrap();
|
||||
let out = std::process::Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||
.args([
|
||||
"call",
|
||||
file.to_str().unwrap(),
|
||||
"计算器.加法",
|
||||
"a=2",
|
||||
"b=3",
|
||||
])
|
||||
.output()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
out.status.code(),
|
||||
Some(0),
|
||||
"skill golden failed\nstderr={}\nstdout={}\nsource=\n{golden}",
|
||||
String::from_utf8_lossy(&out.stderr),
|
||||
String::from_utf8_lossy(&out.stdout)
|
||||
);
|
||||
assert_eq!(String::from_utf8_lossy(&out.stdout).trim(), "5");
|
||||
}
|
||||
|
||||
fn fence_after<'a>(body: &'a str, heading: &str) -> &'a str {
|
||||
let rest = body
|
||||
.split_once(heading)
|
||||
.unwrap_or_else(|| panic!("missing {heading}"))
|
||||
.1;
|
||||
let start = rest
|
||||
.find("```markdown\n")
|
||||
.unwrap_or_else(|| panic!("{heading} has no markdown fence"));
|
||||
let rest = &rest[start + "```markdown\n".len()..];
|
||||
let end = rest.find("\n```").expect("fence end");
|
||||
rest[..end].trim()
|
||||
// Exercise the authoritative executable handbook rather than a copied
|
||||
// Markdown fence that could drift from the skill's actual task entry.
|
||||
let file = root.join("doc/library-development.mq.md");
|
||||
let out = std::process::Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||
.args(["call",file.to_str().unwrap(),"计算金额","单价=2","数量=3"])
|
||||
.output().unwrap();
|
||||
assert_eq!(out.status.code(),Some(0),"handbook call failed: {}",String::from_utf8_lossy(&out.stderr));
|
||||
assert_eq!(String::from_utf8_lossy(&out.stdout).trim(),"6");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user