From 0c3a2b80f83971e65df13b91983dfb44e7463914 Mon Sep 17 00:00:00 2001 From: Michael Bryan Date: Mon, 10 Jul 2017 18:23:51 +0800 Subject: [PATCH] Tested MDBook::init with custom args --- tests/init.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/init.rs b/tests/init.rs index a31abacb..2e0fcf8c 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -21,3 +21,23 @@ fn run_mdbook_init() { assert!(temp.path().join(file).exists(), "{} doesn't exist", file); } } + +#[test] +fn run_mdbook_init_with_custom_args() { + let created_files = vec!["out", "in", "in/SUMMARY.md", "in/chapter_1.md"]; + + let temp = TempDir::new("mdbook").unwrap(); + for file in &created_files { + assert!(!temp.path().join(file).exists()); + } + + let mut md = MDBook::new(temp.path()) + .with_source("in") + .with_destination("out"); + + md.init().unwrap(); + + for file in &created_files { + assert!(temp.path().join(file).exists(), "{} doesn't exist", file); + } +}