diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2020-05-12 17:07:44 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2020-06-08 14:36:13 +0200 |
commit | c51d96b98f1ed92fe7bc6d964abb0d2a8616bae1 (patch) | |
tree | 9fb9ea374e712da619c0985b9ddc0f4377b0b749 /openpgp/src/types/timestamp.rs | |
parent | 5be97d9c6ee82f068a5b38aa455f31497d3f20bf (diff) |
openpgp: Introduce feature flag for quickcheck.
- Make quickcheck dependency optional.
- Make quickcheck a dev-dependency for tests.
- Fix doctests for
- cert::ValidCert::user_attributes,
- cert::builder::CertBuilder::add_user_attribute,
- cert::revoke::UserAttributeRevocationBuilder
- cert::revoke::UserAttributeRevocationBuilder::build.
Doctests do not use cfg(test), so we cannot use quickcheck in there.
Diffstat (limited to 'openpgp/src/types/timestamp.rs')
-rw-r--r-- | openpgp/src/types/timestamp.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs index bd4f3bbb..6e4aebbd 100644 --- a/openpgp/src/types/timestamp.rs +++ b/openpgp/src/types/timestamp.rs @@ -3,6 +3,8 @@ use std::convert::{TryFrom, TryInto}; use std::fmt; use std::time::{SystemTime, Duration as SystemDuration, UNIX_EPOCH}; use std::u32; + +#[cfg(any(test, feature = "quickcheck"))] use quickcheck::{Arbitrary, Gen}; use crate::{ @@ -242,6 +244,7 @@ impl Timestamp { } } +#[cfg(any(test, feature = "quickcheck"))] impl Arbitrary for Timestamp { fn arbitrary<G: Gen>(g: &mut G) -> Self { Timestamp(u32::arbitrary(g)) @@ -562,6 +565,7 @@ impl Timestamp { pub(crate) const Y2106 : Timestamp = Timestamp(4291747200); } +#[cfg(any(test, feature = "quickcheck"))] impl Arbitrary for Duration { fn arbitrary<G: Gen>(g: &mut G) -> Self { Duration(u32::arbitrary(g)) |