diff --git a/openpgp-card/src/lib.rs b/openpgp-card/src/lib.rs index 022c9fd..4995cd5 100644 --- a/openpgp-card/src/lib.rs +++ b/openpgp-card/src/lib.rs @@ -158,27 +158,3 @@ impl KeyType { } } } - -#[cfg(test)] -mod test { - use super::tlv::tag::Tag; - use super::tlv::{Tlv, TlvEntry}; - - #[test] - fn test_tlv() { - let cpkt = Tlv( - Tag(vec![0x7F, 0x48]), - TlvEntry::S(vec![ - 0x91, 0x03, 0x92, 0x82, 0x01, 0x00, 0x93, 0x82, 0x01, 0x00, - ]), - ); - - assert_eq!( - cpkt.serialize(), - vec![ - 0x7F, 0x48, 0x0A, 0x91, 0x03, 0x92, 0x82, 0x01, 0x00, 0x93, - 0x82, 0x01, 0x00, - ] - ); - } -} diff --git a/openpgp-card/src/tlv/mod.rs b/openpgp-card/src/tlv/mod.rs index 0bd40a4..5d74e9f 100644 --- a/openpgp-card/src/tlv/mod.rs +++ b/openpgp-card/src/tlv/mod.rs @@ -119,6 +119,23 @@ mod test { use anyhow::Result; use hex_literal::hex; + #[test] + fn test_tlv0() { + let cpkt = Tlv( + Tag(vec![0x7F, 0x48]), + TlvEntry::S(vec![ + 0x91, 0x03, 0x92, 0x82, 0x01, 0x00, 0x93, 0x82, 0x01, 0x00, + ]), + ); + + assert_eq!( + cpkt.serialize(), + vec![ + 0x7F, 0x48, 0x0A, 0x91, 0x03, 0x92, 0x82, 0x01, 0x00, 0x93, + 0x82, 0x01, 0x00, + ] + ); + } #[test] fn test_tlv() -> Result<()> { // From OpenPGP card spec ยง 7.2.6