Skip to content

Commit 5482598

Browse files
committed
fix(lab/6): unit test cannot compile
1 parent 557c00e commit 5482598

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/0x06/pkg/storage/src/fs/fat16/bpb.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ mod tests {
9292
65 73 73 20 61 6E 79 20 6B 65 79 20 74 6F 20 74
9393
72 79 20 61 67 61 69 6E 20 2E 2E 2E 20 0D 0A 00"
9494
);
95-
96-
const PADDING: &[u8] = concat_bytes!([0x00; 318], [0x55, 0xAA]);
97-
98-
let mut bpb_data = DATA.to_vec();
99-
bpb_data.extend_from_slice(PADDING);
95+
96+
let mut bpb_data = Vec::with_capacity(512);
97+
bpb_data.extend_from_slice(&DATA);
98+
bpb_data.resize(510, 0u8);
99+
bpb_data.extend_from_slice(&[0x55, 0xAA]);
100100

101101
let bpb = Fat16Bpb::new(&bpb_data).unwrap();
102102

@@ -135,10 +135,10 @@ mod tests {
135135
56 56 46 41 54 20 46 41 54 31 36 20 20 20 00 00"
136136
);
137137

138-
const PADDING: &[u8] = concat_bytes!([0x00; 446], [0x55, 0xAA]);
139-
140-
let mut bpb_data = DATA.to_vec();
141-
bpb_data.extend_from_slice(PADDING);
138+
let mut bpb_data = Vec::with_capacity(512);
139+
bpb_data.extend_from_slice(&DATA);
140+
bpb_data.resize(510, 0u8);
141+
bpb_data.extend_from_slice(&[0x55, 0xAA]);
142142

143143
let bpb = Fat16Bpb::new(&bpb_data).unwrap();
144144

src/0x06/pkg/storage/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![cfg_attr(not(test), no_std)]
22
#![allow(dead_code, unused_imports)]
3-
#![cfg_attr(test, feature(concat_bytes))]
43
#![feature(trait_alias)]
54

65
#[macro_use]

0 commit comments

Comments
 (0)