1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-09-29 20:41:24 +02:00
crowbook/tests/book.rs
Elisabeth Henry 54ca041d5a Clean Book constructors API
- Book::new takes an additional `options` parameter.
- Book::new_from_file_with_options becomes `new_from_file`, which got
  deleted.

This way, each constructor takes an `options` parameter (which can
be set to `&[]` for default options), allowing derived constructors to
not replicate the setting options code.
2016-03-03 20:56:28 +01:00

18 lines
582 B
Rust

extern crate crowbook;
use crowbook::{Book, InfoLevel};
use std::io;
#[test]
fn test_book() {
let book = Book::new_from_file(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), "tests/test.book"), InfoLevel::Error, &[]).unwrap();
book.render_html(&mut io::sink()).unwrap();
book.render_tex(&mut io::sink()).unwrap();
}
#[test]
fn book_example() {
let book = Book::new_from_file(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), "config.book"), InfoLevel::Error, &[]).unwrap();
book.render_html(&mut io::sink()).unwrap();
book.render_tex(&mut io::sink()).unwrap();
}