Skip to content

Commit

Permalink
Add doc and smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-uk1 committed Aug 22, 2017
1 parent 7dfa4f9 commit 34b8739
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ macro_rules! closure (
/// // will use &[u8] as input type (use this if the compiler
/// // complains about lifetime issues
/// named!(my_function<&[u8]>, tag!("abcd"));
/// //prefix them with 'pub' to make the functions public
/// // prefix them with 'pub' to make the functions public
/// named!(pub my_function, tag!("abcd"));
/// // prefix them with 'pub(crate)' to make the functions public within the crate
/// named!(pub(crate) my_function, tag!("abcd"));
/// ```
#[macro_export]
macro_rules! named (
Expand Down Expand Up @@ -1298,6 +1300,17 @@ mod tests {
assert_eq!(res, Done(&b""[..], a));
}

mod pub_crate_named_mod {
named!(pub(crate) tst, tag!("abcd"));
}

#[test]
fn pub_crate_named_test() {
let a = &b"abcd"[..];
let res = pub_crate_named_mod::tst(a);
assert_eq!(res, Done(&b""[..], a));
}

#[test]
fn apply_test() {
fn sum2(a:u8, b:u8) -> u8 { a + b }
Expand Down

0 comments on commit 34b8739

Please sign in to comment.