diff --git a/crates/engine/src/cmd/help.rs b/crates/engine/src/cmd/help.rs index c6f315f30..996817ce3 100644 --- a/crates/engine/src/cmd/help.rs +++ b/crates/engine/src/cmd/help.rs @@ -20,7 +20,8 @@ fn sibling(s: &mut Session, p: &Value) -> Result { fn docs(s: &mut Session, p: &Value) -> Result { let page = match str_p(p, "page").unwrap_or("help") { "scripting" => "docs/control-protocol.md", - "expressions" => "docs/expressions.md", + // The reader-facing expression reference is not written yet: the closest page is the parity notes. + "expressions" => "docs/scripting-parity.md", "effects" => "docs/effects.md", "agents" => "docs/agents.md", _ => "README.md", diff --git a/crates/engine/src/tests/session.rs b/crates/engine/src/tests/session.rs index 19bf93090..b253640e7 100644 --- a/crates/engine/src/tests/session.rs +++ b/crates/engine/src/tests/session.rs @@ -497,6 +497,19 @@ fn help_links_emit_urls() { assert_eq!(s.execute("help.github", json!({})).unwrap()["url"], "https://github.com/storytold/effectcraft"); } +/// Every Help ▸ documentation page opens a file that is in the repository (#2696: Expression Reference opened a 404). +#[test] +fn help_docs_pages_exist_in_the_repository() { + let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); + for page in [None, Some("help"), Some("scripting"), Some("expressions"), Some("effects"), Some("agents")] { + let mut s = Session::default(); + let params = page.map_or_else(|| json!({}), |p| json!({"page": p})); + let url = s.execute("help.docs", params).unwrap()["url"].as_str().unwrap().to_owned(); + let path = url.strip_prefix("https://github.com/storytold/effectcraft/blob/main/").unwrap_or_else(|| panic!("{page:?}: {url}")); + assert!(root.join(path).is_file(), "{page:?} opens {url}, which is not in the repository"); + } +} + #[test] fn time_navigation() { let mut s = demo();