Skip to content

Commit f73c805

Browse files
committed
der: test clarify inception + features default = []
1 parent 46e54d9 commit f73c805

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

der/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ hex-literal = "1"
3333
proptest = "1"
3434

3535
[features]
36-
default = ["clarify"]
36+
default = []
3737
alloc = ["zeroize?/alloc"]
3838
std = ["alloc"]
3939

der/tests/clarify.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub mod sequence {
66

77
use const_oid::ObjectIdentifier;
88
use der::{
9-
AnyRef, ClarifyFlavor, EncodeClarifyExt, Sequence, ValueOrd,
9+
AnyRef, ClarifyFlavor, Decode, EncodeClarifyExt, Sequence, ValueOrd,
1010
asn1::{OctetString, SetOf},
1111
};
1212
use hex_literal::hex;
@@ -38,7 +38,7 @@ pub mod sequence {
3838

3939
#[test]
4040
fn clarify_simple_octetstring_javacomments() {
41-
let obj = OctetString::new(&[0xAA, 0xBB, 0xCC]).unwrap();
41+
let obj = OctetString::new(hex!("AA BB CC")).unwrap();
4242

4343
let clarified = obj
4444
.to_der_clarify(ClarifyFlavor::JavaComments)
@@ -52,7 +52,7 @@ pub mod sequence {
5252

5353
#[test]
5454
fn clarify_simple_octetstring_rusthex() {
55-
let obj = OctetString::new(&[0xAA, 0xBB, 0xCC]).unwrap();
55+
let obj = OctetString::new(hex!("AA BB CC")).unwrap();
5656

5757
let clarified = obj
5858
.to_der_clarify(ClarifyFlavor::RustHex)
@@ -66,10 +66,12 @@ pub mod sequence {
6666

6767
#[test]
6868
fn clarify_simple_octetstring_long_rusthex() {
69-
let obj = OctetString::new(&[
70-
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD,
71-
0xEE, 0xFF, 0x01,
72-
])
69+
let obj = OctetString::from_der(&hex!(
70+
"04 11" // tag: OCTET STRING len: 17 type: OctetString
71+
"00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
72+
01"
73+
"" // end: OctetString
74+
))
7375
.unwrap();
7476

7577
let clarified = obj
@@ -81,13 +83,5 @@ pub mod sequence {
8183
clarified,
8284
"\n\"04 11\" // tag: OCTET STRING len: 17 type: OctetString \n\t\"00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF \n\t01\"\n\"\" // end: OctetString "
8385
);
84-
85-
// use-case example:
86-
hex!(
87-
"04 11" // tag: OCTET STRING len: 17 type: OctetString
88-
"00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
89-
01"
90-
"" // end: OctetString
91-
);
9286
}
9387
}

0 commit comments

Comments
 (0)