Migrate able_to_include_playground_files_in_chapters to BookTest
This commit is contained in:
parent
9952ac15a5
commit
342b6ee7b5
2 changed files with 16 additions and 16 deletions
|
|
@ -334,22 +334,6 @@ fn check_link_target_fallback() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This makes sure you can include a Rust file with `{{#playground example.rs}}`.
|
|
||||||
/// Specification is in `guide/src/format/rust.md`
|
|
||||||
#[test]
|
|
||||||
fn able_to_include_playground_files_in_chapters() {
|
|
||||||
let temp = DummyBook::new().build().unwrap();
|
|
||||||
let md = MDBook::load(temp.path()).unwrap();
|
|
||||||
md.build().unwrap();
|
|
||||||
|
|
||||||
let second = temp.path().join("book/second.html");
|
|
||||||
|
|
||||||
let playground_strings = &[r#"class="playground""#, r#"println!("Hello World!");"#];
|
|
||||||
|
|
||||||
assert_contains_strings(&second, playground_strings);
|
|
||||||
assert_doesnt_contain_strings(&second, &["{{#playground example.rs}}"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn example_book_can_build() {
|
fn example_book_can_build() {
|
||||||
let example_book_dir = dummy_book::new_copy_of_example_book().unwrap();
|
let example_book_dir = dummy_book::new_copy_of_example_book().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -68,3 +68,19 @@ Around the world, around the world</p>
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks the behavior of `{{#playground}}` include.
|
||||||
|
#[test]
|
||||||
|
fn playground_include() {
|
||||||
|
BookTest::from_dir("includes/all_includes")
|
||||||
|
.check_main_file("book/playground.html",
|
||||||
|
str![[r##"
|
||||||
|
<h1 id="playground-includes"><a class="header" href="#playground-includes">Playground Includes</a></h1>
|
||||||
|
<pre><pre class="playground"><code class="language-rust">fn main() {
|
||||||
|
println!("Hello World!");
|
||||||
|
<span class="boring">
|
||||||
|
</span><span class="boring"> // You can even hide lines! :D
|
||||||
|
</span><span class="boring"> println!("I am hidden! Expand the code snippet to see me");
|
||||||
|
</span>}</code></pre></pre>
|
||||||
|
"##]]);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue