File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "coverage_score" : 81.1 ,
2
+ "coverage_score" : 80.8 ,
3
3
"exclude_path" : " " ,
4
4
"crate_features" : " bzimage,elf" ,
5
5
"exclude_path" : " benches/,loader_gen/"
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ fn valid_element(s: &str) -> Result<()> {
96
96
/// let cl_cstring = CString::new(cl).unwrap();
97
97
/// assert_eq!(cl_cstring.to_str().unwrap(), "");
98
98
/// ```
99
+ #[ derive( Debug ) ]
99
100
pub struct Cmdline {
100
101
line : String ,
101
102
capacity : usize ,
@@ -337,6 +338,12 @@ impl From<Cmdline> for Vec<u8> {
337
338
}
338
339
}
339
340
341
+ impl PartialEq for Cmdline {
342
+ fn eq ( & self , other : & Self ) -> bool {
343
+ self . line == other. line
344
+ }
345
+ }
346
+
340
347
#[ cfg( test) ]
341
348
mod tests {
342
349
use super :: * ;
@@ -479,4 +486,18 @@ mod tests {
479
486
assert ! ( cl. insert_multiple( "foo" , & [ "bar" , "baz" ] ) . is_ok( ) ) ;
480
487
assert_eq ! ( cl. as_str( ) , "foo=bar,baz" ) ;
481
488
}
489
+
490
+ #[ test]
491
+ fn test_partial_eq ( ) {
492
+ let mut c1 = Cmdline :: new ( 20 ) ;
493
+ let mut c2 = Cmdline :: new ( 30 ) ;
494
+
495
+ c1. insert_str ( "hello world!" ) . unwrap ( ) ;
496
+ c2. insert_str ( "hello" ) . unwrap ( ) ;
497
+ assert_ne ! ( c1, c2) ;
498
+
499
+ // `insert_str` also adds a whitespace before the string being inserted.
500
+ c2. insert_str ( "world!" ) . unwrap ( ) ;
501
+ assert_eq ! ( c1, c2) ;
502
+ }
482
503
}
You can’t perform that action at this time.
0 commit comments