feat: adopt marqdo 3.0.0-rc.4 public analysis boundary
This commit is contained in:
1 parent
769550b14b
commit
fe18df6c4b
74 files changed
+7618
-5368
No files matched your search
+64
-6
@@ -19,7 +19,7 @@ fn rule_commands_do_not_require_the_core() {
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
let rules: Vec<Value> = serde_json::from_slice(&output.stdout).unwrap();
|
||||
assert_eq!(rules.len(), 18);
|
||||
assert_eq!(rules.len(), 22);
|
||||
|
||||
let output = lint()
|
||||
.env("MARQDO_BIN", "no-such-core")
|
||||
@@ -95,11 +95,7 @@ reason = "Fixture for a deliberately short helper"
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.contains("sem.unclosed_control"));
|
||||
assert!(result["diagnostics"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.any(|d| d["id"] == "MQD-KNOW-001"));
|
||||
assert!(result["diagnostics"].as_array().unwrap().is_empty());
|
||||
let invalid_signature = "## @exec x\n\n- `params(n: Int)`\n\n*return 1*";
|
||||
fs::write(temp.path().join("index.mq.md"), invalid_signature).unwrap();
|
||||
let (code, result) = report(&[]);
|
||||
@@ -349,3 +345,65 @@ fn t16_exec_emphasis_inside_prose_is_not_a_comment() {
|
||||
.iter()
|
||||
.any(|d| d["id"] == "MQD-PROSE-001"));
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn old_tool_manifest_is_rejected_and_new_manifest_requires_revision_one() {
|
||||
let Some(core) = std::env::var_os("MARQDO_BIN") else {
|
||||
return;
|
||||
};
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let bundle = temp.path().join("bundle");
|
||||
fs::create_dir_all(bundle.join("bin")).unwrap();
|
||||
fs::copy(
|
||||
env!("CARGO_BIN_EXE_marqdo-lint"),
|
||||
bundle.join("bin/marqdo-lint"),
|
||||
)
|
||||
.unwrap();
|
||||
let manifest = bundle.join("tool.json");
|
||||
fs::write(&manifest, include_bytes!("../tool.json")).unwrap();
|
||||
let value: Value = serde_json::from_slice(&fs::read(&manifest).unwrap()).unwrap();
|
||||
assert_eq!(value["requires"]["api_revision"], 1);
|
||||
assert_eq!(value["requires"]["analysis"], 3);
|
||||
assert!(value.get("compatibility").is_none());
|
||||
let marqdo = || {
|
||||
let mut command = Command::new(&core);
|
||||
command
|
||||
.env("MARQDO_TOOL_HOME", temp.path().join("registry"))
|
||||
.env_remove("MARQDO_BIN");
|
||||
command
|
||||
};
|
||||
assert!(marqdo()
|
||||
.args(["tool", "install"])
|
||||
.arg(&manifest)
|
||||
.output()
|
||||
.unwrap()
|
||||
.status
|
||||
.success());
|
||||
assert!(marqdo()
|
||||
.args(["tool", "remove", "lint"])
|
||||
.output()
|
||||
.unwrap()
|
||||
.status
|
||||
.success());
|
||||
|
||||
let old = value;
|
||||
let mut object = old.as_object().unwrap().clone();
|
||||
object.insert(
|
||||
"compatibility".into(),
|
||||
serde_json::json!({"marqdo": ">=3.0.0-rc.1,<4.0.0", "analysis": [2, 3]}),
|
||||
);
|
||||
fs::write(
|
||||
&manifest,
|
||||
serde_json::to_vec(&Value::Object(object)).unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
let output = marqdo()
|
||||
.args(["tool", "install"])
|
||||
.arg(&manifest)
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(!output.status.success(), "{output:?}");
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(stderr.contains("compatibility"), "{stderr}");
|
||||
}
|
||||
Reference in new issue
Block a user