File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -97,4 +97,14 @@ mod tests {
97
97
let message = EndpointName :: try_from ( & buffer[ ..] ) . unwrap ( ) ;
98
98
assert_eq ! ( message. name( ) , "Gimme some signal 🔊 🙌" ) ;
99
99
}
100
+
101
+ #[ test]
102
+ fn read_empty_bytes ( ) {
103
+ assert_eq ! (
104
+ EndpointName :: <std:: vec:: Vec <u32 >>:: new( )
105
+ . name_bytes( )
106
+ . collect:: <std:: vec:: Vec <u8 >>( ) ,
107
+ std:: vec![ ]
108
+ ) ;
109
+ }
100
110
}
Original file line number Diff line number Diff line change @@ -190,4 +190,14 @@ mod tests {
190
190
0x9 ,
191
191
) ;
192
192
}
193
+
194
+ #[ test]
195
+ fn read_empty_bytes ( ) {
196
+ assert_eq ! (
197
+ FunctionBlockName :: <std:: vec:: Vec <u32 >>:: new( )
198
+ . name_bytes( )
199
+ . collect:: <std:: vec:: Vec <u8 >>( ) ,
200
+ std:: vec![ ] ,
201
+ ) ;
202
+ }
193
203
}
Original file line number Diff line number Diff line change @@ -268,14 +268,14 @@ pub struct TextBytesIterator<'a> {
268
268
impl < ' a > core:: iter:: Iterator for TextBytesIterator < ' a > {
269
269
type Item = u8 ;
270
270
fn next ( & mut self ) -> Option < Self :: Item > {
271
+ while !self . finished ( ) && self . value ( ) == 0 {
272
+ self . advance ( ) ;
273
+ }
271
274
if self . finished ( ) {
272
275
return None ;
273
276
}
274
277
let ret = Some ( self . value ( ) ) ;
275
278
self . advance ( ) ;
276
- while !self . finished ( ) && self . value ( ) == 0 {
277
- self . advance ( ) ;
278
- }
279
279
ret
280
280
}
281
281
You can’t perform that action at this time.
0 commit comments