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 {
121121 assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
122122 assert_eq ! ( tag. name( ) , Ok ( "hello" ) ) ;
123123
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+
124130 // test also some bigger message
125131 let tag = BootLoaderNameTag :: new ( "AbCdEfGhUjK YEAH" ) ;
126132 assert_eq ! ( tag. name( ) , Ok ( "AbCdEfGhUjK YEAH" ) ) ;
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ mod tests {
115115 assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
116116 assert_eq ! ( tag. cmdline( ) , Ok ( "hello" ) ) ;
117117
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+
118124 // test also some bigger message
119125 let tag = CommandLineTag :: new ( "AbCdEfGhUjK YEAH" ) ;
120126 assert_eq ! ( tag. cmdline( ) , Ok ( "AbCdEfGhUjK YEAH" ) ) ;
Original file line number Diff line number Diff line change @@ -166,6 +166,12 @@ mod tests {
166166 assert_eq ! ( bytes, & get_bytes( ) [ ..tag. size( ) ] ) ;
167167 assert_eq ! ( tag. cmdline( ) , Ok ( "hello" ) ) ;
168168
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+
169175 // test also some bigger message
170176 let tag = ModuleTag :: new ( 0 , 1 , "AbCdEfGhUjK YEAH" ) ;
171177 assert_eq ! ( tag. cmdline( ) , Ok ( "AbCdEfGhUjK YEAH" ) ) ;
You can’t perform that action at this time.
0 commit comments