// Copyright 2018 Fredrik Portström // This is free software distributed under the terms specified in // the file LICENSE at the top-level directory of this distribution. extern crate parse_mediawiki_dump; const DUMP: &str = concat!( r#""#, "", "0", "alpha", "", "beta", "gamma", "delta", "", "", "", "42", "epsilon", "", "zeta", "", "", "" ); #[test] fn main() { let mut parser = parse_mediawiki_dump::parse(std::io::BufReader::new(std::io::Cursor::new(DUMP))); assert!(match parser.next() { Some(Ok(parse_mediawiki_dump::Page { format: Some(format), model: Some(model), namespace: 0, text, title, })) => format == "beta" && model == "gamma" && text == "delta" && title == "alpha", _ => false, }); assert!(match parser.next() { Some(Ok(parse_mediawiki_dump::Page { format: None, model: None, namespace: 42, text, title, })) => text == "zeta" && title == "epsilon", _ => false, }); assert!(parser.next().is_none()); }