Skip to content

Commit

Permalink
Add test module
Browse files Browse the repository at this point in the history
There is maybe no reason for this in a macro only crate, but minor
benefits exist according to http://stackoverflow.com/a/40271926/667457

I tested that adding #[cfg(test)] before each #[test] works too.
  • Loading branch information
burdges committed Oct 26, 2016
1 parent 1473a49 commit efcb498
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
//! ```
#![deny(warnings)]

#[cfg(test)]
extern crate quickcheck;

/// You can use `array_ref` to generate an array reference to a subset
/// of a sliceable bit of data (which could be an array, or a slice,
/// or a Vec).
Expand Down Expand Up @@ -224,6 +221,14 @@ macro_rules! array_mut_ref {
}}
}


#[cfg(test)]
mod test {

extern crate quickcheck;

// use super::*;

#[test]
#[should_panic]
fn checks_bounds() {
Expand Down Expand Up @@ -349,3 +354,5 @@ fn test_5_mut_xarray_refs() {
assert_eq!(&[3;3], array_ref![data, 15, 3]);
assert_eq!(&[10;10], array_ref![data, 118, 10]);
}

} // mod test

0 comments on commit efcb498

Please sign in to comment.