webidl: Add logging and use env_logger in the tests

This commit is contained in:
Nick Fitzgerald
2018-06-01 15:24:48 -07:00
parent 346d2fda22
commit 8faebc56f2
5 changed files with 64 additions and 13 deletions

View File

@ -1,4 +1,5 @@
use diff;
use env_logger;
use std::io::{self, Write};
use std::process;
use std::sync::{Once, ONCE_INIT};
@ -90,6 +91,11 @@ fn strip_wasm_bindgen_generated(source: String) -> String {
}
pub fn assert_compile(webidl: &str, expected: &str) {
static INIT_ENV_LOGGER: Once = ONCE_INIT;
INIT_ENV_LOGGER.call_once(|| {
env_logger::init();
});
let actual = wb_webidl::compile(webidl).expect("should compile the webidl source OK");
let (actual, actual_stderr) = rustfmt(actual);