#[macro_use]
extern crate nom;
use nom::{IResult,Producer,FileProducer,not_line_ending};
use std::str;
use std::fmt::Debug;
#[test]
#[allow(unused_must_use)]
fn tag() {
FileProducer::new("links.txt", 20).map(|producer: FileProducer| {
let mut p = producer;
named!(pr<&[u8], ()>, flat_map!(map_res!(tag!("https!"), str::from_utf8), print));
pusher!(ps, pr);
ps(&mut p);
});
}
pub fn print<'a, T: Debug>(input: T) -> IResult<'a,T,()> {
println!("{:?}", input);
IResult::Done(input, ())
}
#[test]
fn is_not() {
named!(foo<&[u8],&[u8]>, is_not!(&b"\r\n"[..]));
let a = &b"ab12cd\nefgh"[..];
assert_eq!(foo(a), IResult::Done(&b"\nefgh"[..], &b"ab12cd"[..]));
}
#[test]
fn exported_public_method_defined_by_macro() {
let a = &b"ab12cd\nefgh"[..];
assert_eq!(not_line_ending(a), IResult::Done(&b"\nefgh"[..], &b"ab12cd"[..]));
}