Skip to content

Commit

Permalink
Add #[cfg(feature = alloc)] to tests which require the nom alloc feat…
Browse files Browse the repository at this point in the history
…ure.
  • Loading branch information
rekanorman committed Feb 4, 2020
1 parent 8167cf4 commit 6b72f8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ runtime-dispatch-simd = ["bytecount/runtime-dispatch-simd"]
[dependencies]
bytecount = "^0.6"
memchr = ">=1.0.1, <3.0.0" # ^1.0.0 + ^2.0
nom = { version = "5.0.0", default-features = false, features = ["std"] }
nom = { version = "5.0.0", default-features = false }
6 changes: 6 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::ops::{Range, RangeFull};
type StrSpan<'a> = LocatedSpan<&'a str>;
type BytesSpan<'a> = LocatedSpan<&'a [u8]>;

#[cfg(feature = "alloc")]
named!(simple_parser_str< StrSpan, Vec<StrSpan> >, do_parse!(
foo: ws!(tag!("foo")) >>
bar: ws!(tag!("bar")) >>
Expand All @@ -23,6 +24,7 @@ named!(simple_parser_str< StrSpan, Vec<StrSpan> >, do_parse!(
})
));

#[cfg(feature = "alloc")]
named!(simple_parser_u8< BytesSpan, Vec<BytesSpan> >, do_parse!(
foo: ws!(tag!("foo")) >>
bar: ws!(tag!("bar")) >>
Expand Down Expand Up @@ -82,6 +84,7 @@ where
}
}

#[cfg(feature = "alloc")]
#[test]
fn it_locates_str_fragments() {
test_str_fragments(
Expand Down Expand Up @@ -148,6 +151,7 @@ fn it_locates_str_fragments() {
);
}

#[cfg(feature = "alloc")]
#[test]
fn it_locates_u8_fragments() {
test_str_fragments(
Expand Down Expand Up @@ -253,6 +257,7 @@ fn test_escaped_string() {
);
}

#[cfg(feature = "alloc")]
named!(plague<StrSpan, Vec<StrSpan> >, do_parse!(
bacille: call!(find_substring, "le bacille") >>
bacille_pronouns: many0!(call!(find_substring, "il ")) >>
Expand All @@ -266,6 +271,7 @@ named!(plague<StrSpan, Vec<StrSpan> >, do_parse!(
})
));

#[cfg(feature = "alloc")]
#[test]
fn it_locates_complex_fragments() {
// Lorem ipsum is boring. Let's quote Camus' Plague.
Expand Down

0 comments on commit 6b72f8b

Please sign in to comment.