diff --git a/tests/rendered_output.rs b/tests/rendered_output.rs index beb83ebd..ab69a359 100644 --- a/tests/rendered_output.rs +++ b/tests/rendered_output.rs @@ -773,9 +773,10 @@ mod search { fn read_book_index(root: &Path) -> serde_json::Value { let index = root.join("book/searchindex.js"); let index = fs::read_to_string(index).unwrap(); - let index = index.trim_start_matches("Object.assign(window.search, "); - let index = index.trim_end_matches(");"); - serde_json::from_str(index).unwrap() + let index = index.trim_start_matches("window.search = JSON.parse('"); + let index = index.trim_end_matches("');"); + // We need unescape the string as it's supposed to be an escaped JS string. + serde_json::from_str(&index.replace("\\'", "'").replace("\\\\", "\\")).unwrap() } #[test]