Codebase list rust-stfu8 / 134a7e2
fix autopkgtest for binascii Matthias Geiger 1 year, 8 months ago
4 changed file(s) with 102 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
(New empty file)
0 rust-binascii (0.1.4-3) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Import upstream commit 881285b to fix autopkgtest
3
4 -- Matthias Geiger <matthias.geiger1024@tutanota.de> Sat, 03 Sep 2022 21:57:12 -0700
5
06 rust-binascii (0.1.4-2) unstable; urgency=medium
17
28 * Team upload.
0 diff --git a/src/lib.rs b/src/lib.rs
1 index ab15d58..efc1ff6 100644
2 --- a/src/lib.rs
3 +++ b/src/lib.rs
4 @@ -6,7 +6,7 @@
5 //! Most functions of this crate work the same way.
6 //!
7 //! # Quick Example
8 -//! ```
9 +//! ```feature=decode
10 //! use binascii::b32decode;
11 //!
12 //! let mut output_buffer = [0u8; 200];
13 diff --git a/src/tests.rs b/src/tests.rs
14 index 3b6d1c7..0cc499a 100644
15 --- a/src/tests.rs
16 +++ b/src/tests.rs
17 @@ -1,6 +1,7 @@
18 use super::*;
19 const SAMPLE_DATA: &str = "This is a short sentence the we'll use for testing.";
20
21 +#[cfg(feature = "decode")]
22 #[test]
23 fn test_hex2bin() {
24 let mut output_buffer = [0u8; 100];
25 @@ -19,6 +20,7 @@ fn test_hex2bin() {
26 assert!(hex2bin("a".as_bytes(), &mut output_buffer).is_err());
27 }
28
29 +#[cfg(feature = "encode")]
30 #[test]
31 fn test_bin2hex() {
32 let mut buffer = [0u8; 200];
33 @@ -30,6 +32,7 @@ fn test_bin2hex() {
34 assert!(bin2hex(&[0x1f, 0xf2], &mut buffer[0..2]).is_err());
35 }
36
37 +#[cfg(all(feature = "encode", feature="decode"))]
38 #[test]
39 fn base32_sanity() {
40 for length in 0..30 {
41 @@ -45,6 +48,7 @@ fn base32_sanity() {
42 }
43 }
44
45 +#[cfg(all(feature = "encode", feature="decode"))]
46 #[test]
47 fn base64_sanity() {
48 for length in 0..30 {
49 @@ -60,6 +64,7 @@ fn base64_sanity() {
50 }
51 }
52
53 +#[cfg(feature="decode")]
54 #[test]
55 fn base64_padding_checks() {
56 {
57 @@ -93,6 +98,7 @@ fn base64_padding_checks() {
58 }
59 }
60
61 +#[cfg(all(feature = "encode", feature="decode"))]
62 // Check if round tripping an encoded text produces an example of Base64 encoding malleability (bad)
63 fn malleability_check(encoded: &[u8]) {
64 let mut buffer = [0u8; 1000];
65 @@ -107,6 +113,7 @@ fn malleability_check(encoded: &[u8]) {
66 // Some of these patterns are valid encodings and some are invalid, ensure that
67 // either round-tripping them produces an error, or produces the same encoded
68 // string, so that there are no two different valid encodings of the same payload.
69 +#[cfg(all(feature = "encode", feature="decode"))]
70 #[test]
71 fn base64_malleability_checks() {
72 malleability_check(b"00==");
73 @@ -131,17 +138,20 @@ fn decode_tester<F>(f: F) where for <'a> F: Fn(&[u8], &'a mut [u8]) -> Result<&'
74 }
75 }
76
77 +#[cfg(feature="decode")]
78 #[test]
79 fn b16_len_test() {
80 decode_tester(hex2bin);
81 }
82
83 +#[cfg(feature="decode")]
84 #[test]
85 fn b32_len_test() {
86 decode_tester(b32decode);
87 }
88 -#[test]
89
90 +#[cfg(feature="decode")]
91 +#[test]
92 fn b64_len_test() {
93 decode_tester(b64decode);
94 }
0 fix-autopkgtest.diff