Update tests
This commit is contained in:
parent
63e1dac122
commit
f4c54178c8
2 changed files with 4 additions and 3 deletions
|
|
@ -9,8 +9,9 @@ use std::path::{Path, PathBuf};
|
||||||
fn read_book_index(root: &Path) -> serde_json::Value {
|
fn read_book_index(root: &Path) -> serde_json::Value {
|
||||||
let index = root.join("book/searchindex.js");
|
let index = root.join("book/searchindex.js");
|
||||||
let index = std::fs::read_to_string(index).unwrap();
|
let index = std::fs::read_to_string(index).unwrap();
|
||||||
let index = index.trim_start_matches("window.search = JSON.parse('");
|
let index =
|
||||||
let index = index.trim_end_matches("');");
|
index.trim_start_matches("window.search = Object.assign(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.
|
// We need unescape the string as it's supposed to be an escaped JS string.
|
||||||
serde_json::from_str(&index.replace("\\'", "'").replace("\\\\", "\\")).unwrap()
|
serde_json::from_str(&index.replace("\\'", "'").replace("\\\\", "\\")).unwrap()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue