File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,7 @@ macro_rules! string_array_arg {
81
81
. iter( )
82
82
. map( |x| :: std:: ffi:: CString :: new( * x) . expect( "invalid C string" ) )
83
83
. collect:: <:: std:: vec:: Vec <_>>( ) ;
84
- let $name = $name
85
- . iter( )
86
- . map( |x| x. as_ptr( ) )
87
- . collect:: <:: std:: vec:: Vec <_>>( ) ;
84
+ let $name = $name. iter( ) . map( |x| x. as_ptr( ) ) . collect:: <:: std:: vec:: Vec <_>>( ) ;
88
85
} ;
89
86
}
90
87
@@ -95,11 +92,8 @@ macro_rules! string_array_arg_mut {
95
92
. iter( )
96
93
. map( |x| :: std:: ffi:: CString :: new( * x) . expect( "invalid C string" ) )
97
94
. collect:: <:: std:: vec:: Vec <_>>( ) ;
98
- // Casting to mut below trusts on undefined CString behavior.
99
- let mut $name = $name
100
- . iter( )
101
- . map( |x| x. as_ptr( ) . cast_mut( ) )
102
- . collect:: <:: std:: vec:: Vec <_>>( ) ;
95
+ // fixme: Casting to mut below trusts on undefined CString behavior.
96
+ let mut $name = $name. iter( ) . map( |x| x. as_ptr( ) . cast_mut( ) ) . collect:: <:: std:: vec:: Vec <_>>( ) ;
103
97
} ;
104
98
}
105
99
Original file line number Diff line number Diff line change 1
1
//! Contains all tests that cover marshalling types to and from C++
2
2
3
3
use opencv:: core;
4
- use opencv:: core:: { Scalar , SparseMat , Tuple } ;
4
+ use opencv:: core:: { CommandLineParser , Scalar , SparseMat , Tuple } ;
5
5
use opencv:: prelude:: * ;
6
6
use opencv:: Result ;
7
7
@@ -273,3 +273,12 @@ fn tuple() -> Result<()> {
273
273
// assert_eq!(mat.data_typed()?, mat_src.data_typed()?);
274
274
// Ok(())
275
275
// }
276
+
277
+ #[ test]
278
+ fn string_array ( ) -> Result < ( ) > {
279
+ let args = [ "test" , "-a=b" ] ;
280
+ let mut parser = CommandLineParser :: new ( i32:: try_from ( args. len ( ) ) ?, & args, "{a | | }" ) ?;
281
+ assert ! ( parser. has( "a" ) ?) ;
282
+ assert_eq ! ( "b" , parser. get_str( "a" , true ) ?) ;
283
+ Ok ( ( ) )
284
+ }
You can’t perform that action at this time.
0 commit comments