Skip to content

Commit

Permalink
failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Jan 15, 2019
1 parent 1052ee9 commit a481735
Show file tree
Hide file tree
Showing 4 changed files with 346 additions and 57 deletions.
1 change: 1 addition & 0 deletions tests/dummy_book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Includes](first/includes.md)
- [Recursive](first/recursive.md)
- [Second Chapter](second.md)
- [Nested Chapter](second/nested.md)

---

Expand Down
4 changes: 4 additions & 0 deletions tests/dummy_book/src/second/nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Testing relative links for the print page

When we link to [the first section](../first/nested.md), it should work on
both the print page and the non-print page.
18 changes: 16 additions & 2 deletions tests/rendered_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TOC_TOP_LEVEL: &[&'static str] = &[
"Introduction",
];
const TOC_SECOND_LEVEL: &[&'static str] =
&["1.1. Nested Chapter", "1.2. Includes", "1.3. Recursive"];
&["1.1. Nested Chapter", "1.2. Includes", "2.1. Nested Chapter", "1.3. Recursive"];

/// Make sure you can load the dummy book and build it without panicking.
#[test]
Expand Down Expand Up @@ -109,6 +109,20 @@ fn check_correct_cross_links_in_nested_dir() {
);
}

#[test]
fn check_correct_relative_links_in_print_page() {
let temp = DummyBook::new().build().unwrap();
let md = MDBook::load(temp.path()).unwrap();
md.build().unwrap();

let first = temp.path().join("book");

assert_contains_strings(
first.join("print.html"),
&[r##"<a href="second/../first/nested.html">the first section</a>,"##],
);
}

#[test]
fn rendered_code_has_playpen_stuff() {
let temp = DummyBook::new().build().unwrap();
Expand Down Expand Up @@ -443,7 +457,7 @@ mod search {
assert_eq!(docs[&some_section]["body"], "");
assert_eq!(
docs[&summary]["body"],
"Dummy Book Introduction First Chapter Nested Chapter Includes Recursive Second Chapter Conclusion"
"Dummy Book Introduction First Chapter Nested Chapter Includes Recursive Second Chapter Nested Chapter Conclusion"
);
assert_eq!(docs[&summary]["breadcrumbs"], "First Chapter » Summary");
assert_eq!(docs[&conclusion]["body"], "I put &lt;HTML&gt; in here!");
Expand Down
Loading

0 comments on commit a481735

Please sign in to comment.