File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,41 @@ Script ran successfully.
422422"# ] ] ) ;
423423} ) ;
424424
425+ // Tests that the run command can run functions with arguments without specifying the signature
426+ // <https://github.com/foundry-rs/foundry/issues/11240>
427+ forgetest ! ( can_execute_script_command_with_args_no_sig, |prj, cmd| {
428+ let script = prj
429+ . add_source(
430+ "Foo" ,
431+ r#"
432+ contract Demo {
433+ event log_string(string);
434+ event log_uint(uint);
435+ function run(uint256 a, uint256 b) external {
436+ emit log_string("script ran");
437+ emit log_uint(a);
438+ emit log_uint(b);
439+ }
440+ }
441+ "# ,
442+ )
443+ . unwrap( ) ;
444+
445+ cmd. arg( "script" ) . arg( script) . arg( "1" ) . arg( "2" ) . assert_success( ) . stdout_eq( str ![ [ r#"
446+ [COMPILING_FILES] with [SOLC_VERSION]
447+ [SOLC_VERSION] [ELAPSED]
448+ Compiler run successful!
449+ Script ran successfully.
450+ [GAS]
451+
452+ == Logs ==
453+ script ran
454+ 1
455+ 2
456+
457+ "# ] ] ) ;
458+ } ) ;
459+
425460// Tests that the run command can run functions with return values
426461forgetest ! ( can_execute_script_command_with_returned, |prj, cmd| {
427462 let script = prj
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ pub struct ScriptArgs {
9696 pub target_contract : Option < String > ,
9797
9898 /// The signature of the function you want to call in the contract, or raw calldata.
99- #[ arg( long, short, default_value = "run() " ) ]
99+ #[ arg( long, short, default_value = "run" ) ]
100100 pub sig : String ,
101101
102102 /// Max priority fee per gas for EIP1559 transactions.
You can’t perform that action at this time.
0 commit comments