diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/der/tests | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/der/tests')
-rw-r--r-- | vendor/der/tests/derive.rs | 4 | ||||
-rw-r--r-- | vendor/der/tests/set_of.rs | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/vendor/der/tests/derive.rs b/vendor/der/tests/derive.rs index cb6fe183d..a8c77febc 100644 --- a/vendor/der/tests/derive.rs +++ b/vendor/der/tests/derive.rs @@ -200,6 +200,7 @@ mod enumerated { /// Custom derive test cases for the `Sequence` macro. #[cfg(feature = "oid")] mod sequence { + use core::marker::PhantomData; use der::{ asn1::{AnyRef, ObjectIdentifier, SetOf}, Decode, Encode, Sequence, ValueOrd, @@ -266,6 +267,9 @@ mod sequence { tag_mode = "IMPLICIT" )] pub only_contains_attribute_certs: bool, + + /// Test handling of PhantomData. + pub phantom: PhantomData<()>, } // Extension as defined in [RFC 5280 Section 4.1.2.9]. diff --git a/vendor/der/tests/set_of.rs b/vendor/der/tests/set_of.rs index ba43d80a2..d58399198 100644 --- a/vendor/der/tests/set_of.rs +++ b/vendor/der/tests/set_of.rs @@ -4,15 +4,21 @@ use der::{asn1::SetOfVec, DerOrd}; use proptest::{prelude::*, string::*}; +use std::collections::BTreeSet; proptest! { #[test] fn sort_equiv(bytes in bytes_regex(".{0,64}").unwrap()) { - let mut expected = bytes.clone(); - expected.sort_by(|a, b| a.der_cmp(b).unwrap()); + let mut uniq = BTreeSet::new(); - let set = SetOfVec::try_from(bytes).unwrap(); - prop_assert_eq!(expected.as_slice(), set.as_slice()); + // Ensure there are no duplicates + if bytes.iter().copied().all(move |x| uniq.insert(x)) { + let mut expected = bytes.clone(); + expected.sort_by(|a, b| a.der_cmp(b).unwrap()); + + let set = SetOfVec::try_from(bytes).unwrap(); + prop_assert_eq!(expected.as_slice(), set.as_slice()); + } } } |