summaryrefslogtreecommitdiffstats
path: root/vendor/der/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:19 +0000
commita0b8f38ab54ac451646aa00cd5e91b6c76f22a84 (patch)
treefc451898ccaf445814e26b46664d78702178101d /vendor/der/tests
parentAdding debian version 1.71.1+dfsg1-2. (diff)
downloadrustc-a0b8f38ab54ac451646aa00cd5e91b6c76f22a84.tar.xz
rustc-a0b8f38ab54ac451646aa00cd5e91b6c76f22a84.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.rs4
-rw-r--r--vendor/der/tests/set_of.rs14
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());
+ }
}
}