File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,12 @@ mod tests {
121
121
assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
122
122
assert_eq ! ( tag. name( ) , Ok ( "hello" ) ) ;
123
123
124
+ // With terminating null.
125
+ let tag = BootLoaderNameTag :: new ( "hello\0 " ) ;
126
+ let bytes = tag. as_bytes ( ) ;
127
+ assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
128
+ assert_eq ! ( tag. name( ) , Ok ( "hello" ) ) ;
129
+
124
130
// test also some bigger message
125
131
let tag = BootLoaderNameTag :: new ( "AbCdEfGhUjK YEAH" ) ;
126
132
assert_eq ! ( tag. name( ) , Ok ( "AbCdEfGhUjK YEAH" ) ) ;
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ mod tests {
115
115
assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
116
116
assert_eq ! ( tag. cmdline( ) , Ok ( "hello" ) ) ;
117
117
118
+ // With terminating null.
119
+ let tag = CommandLineTag :: new ( "hello\0 " ) ;
120
+ let bytes = tag. as_bytes ( ) ;
121
+ assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
122
+ assert_eq ! ( tag. cmdline( ) , Ok ( "hello" ) ) ;
123
+
118
124
// test also some bigger message
119
125
let tag = CommandLineTag :: new ( "AbCdEfGhUjK YEAH" ) ;
120
126
assert_eq ! ( tag. cmdline( ) , Ok ( "AbCdEfGhUjK YEAH" ) ) ;
Original file line number Diff line number Diff line change @@ -166,6 +166,12 @@ mod tests {
166
166
assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
167
167
assert_eq ! ( tag. cmdline( ) , Ok ( "hello" ) ) ;
168
168
169
+ // With terminating null.
170
+ let tag = ModuleTag :: new ( 0xff00 , 0xffff , "hello\0 " ) ;
171
+ let bytes = tag. as_bytes ( ) ;
172
+ assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
173
+ assert_eq ! ( tag. cmdline( ) , Ok ( "hello" ) ) ;
174
+
169
175
// test also some bigger message
170
176
let tag = ModuleTag :: new ( 0 , 1 , "AbCdEfGhUjK YEAH" ) ;
171
177
assert_eq ! ( tag. cmdline( ) , Ok ( "AbCdEfGhUjK YEAH" ) ) ;
You can’t perform that action at this time.
0 commit comments