mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-31 23:58:21 +00:00
Help: Expression Reference opens a page that exists (#2696)
This commit is contained in:
1 parent
7a9572d8b9
commit
508a2241e9
2 files changed
+15
-1
No files matched your search
@@ -20,7 +20,8 @@ fn sibling(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
fn docs(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user