@@ -25,8 +25,9 @@ impl RpcCommand {
2525 None => return Err ( String :: from ( "RPC URL not specified" ) ) ,
2626 } ;
2727
28- let args: Vec < Value > = match matches. get_many :: < String > ( "rpc-args" ) {
29- Some ( args) => {
28+ let args: Vec < Value > = match matches. try_get_many :: < String > ( "rpc-args" )
29+ {
30+ Ok ( Some ( args) ) => {
3031 let mut params = Vec :: new ( ) ;
3132
3233 for arg in args {
@@ -37,7 +38,8 @@ impl RpcCommand {
3738 }
3839 params
3940 }
40- None => Vec :: new ( ) ,
41+ Ok ( None ) => Vec :: new ( ) ,
42+ Err ( _e) => Vec :: new ( ) ,
4143 } ;
4244
4345 Ok ( Some ( RpcCommand {
@@ -136,6 +138,8 @@ impl<'a> ArgSchema<'a> {
136138#[ cfg( test) ]
137139
138140mod tests {
141+ use std:: vec;
142+
139143 use crate :: cli:: Cli ;
140144
141145 use super :: * ;
@@ -308,6 +312,28 @@ mod tests {
308312 expected_url: "http://localhost:12539" ,
309313 expected_params: vec![ json!( "0x654321fedcba" ) , json!( false ) ] ,
310314 } ,
315+ TestCase {
316+ name: "voting_status" ,
317+ args: vec![ "conflux" , "rpc" , "local" , "pos" , "voting_status" ] ,
318+ expected_method: "test_posVotingStatus" ,
319+ expected_params: vec![ ] ,
320+ expected_url: "http://localhost:12539" ,
321+ } ,
322+ TestCase {
323+ name: "voting_status_with_custom_url" ,
324+ args: vec![
325+ "conflux" ,
326+ "rpc" ,
327+ "local" ,
328+ "pos" ,
329+ "voting_status" ,
330+ "--url" ,
331+ "http://localhost:9999" ,
332+ ] ,
333+ expected_method: "test_posVotingStatus" ,
334+ expected_params: vec![ ] ,
335+ expected_url: "http://localhost:9999" ,
336+ } ,
311337 ] ;
312338
313339 for test_case in test_cases {
0 commit comments