File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed
utils/scarb-extensions-cli/src Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ pub struct ExecuteHintProcessor<'a> {
2121 pub oracle_hint_service : OracleHintService ,
2222 /// Captured felts from `println!` / `print!` statements
2323 /// Only used if `capture_enabled` is true
24- pub captured_print_felts : Vec < Felt252 > ,
24+ pub captured_print_felts : Vec < Vec < Felt252 > > ,
2525 pub capture_enabled : bool ,
2626}
2727
@@ -38,7 +38,7 @@ impl<'a> HintProcessorLogic for ExecuteHintProcessor<'a> {
3838 hint_data. downcast_ref :: < Hint > ( )
3939 {
4040 let felts = read_felts ( vm, start, end) ?;
41- self . captured_print_felts . extend ( felts) ;
41+ self . captured_print_felts . push ( felts) ;
4242 return self
4343 . cairo_hint_processor
4444 . execute_hint ( vm, exec_scopes, hint_data) ;
Original file line number Diff line number Diff line change @@ -198,7 +198,12 @@ pub fn execute(
198198 . flatten ( ) ;
199199
200200 let captured_print_output = if !hint_processor. captured_print_felts . is_empty ( ) {
201- format_for_debug ( hint_processor. captured_print_felts . into_iter ( ) )
201+ hint_processor
202+ . captured_print_felts
203+ . into_iter ( )
204+ . map ( |felts| format_for_debug ( felts. into_iter ( ) ) . to_string ( ) )
205+ . collect :: < Vec < _ > > ( )
206+ . join ( "" )
202207 } else {
203208 String :: new ( )
204209 } ;
Original file line number Diff line number Diff line change @@ -624,7 +624,8 @@ fn can_save_stdout_output_to_file() {
624624 . lib_cairo ( indoc ! { r#"
625625 #[executable]
626626 fn main() -> felt252 {
627- println!("Hello, world!");
627+ println!("Hello");
628+ println!("world!");
628629 42
629630 }
630631 "# } )
@@ -640,11 +641,13 @@ fn can_save_stdout_output_to_file() {
640641 [..]Compiling hello v0.1.0 ([..]Scarb.toml)
641642 [..]Finished `dev` profile target(s) in [..]
642643 [..]Executing hello
643- Hello, world!
644+ Hello
645+ world!
644646 Saving output to: target/execute/hello/execution1
645647 "# } ) ;
646648
647649 let stdout_output_path = t. child ( "target/execute/hello/execution1/stdout_output.txt" ) ;
648650 stdout_output_path. assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
649- stdout_output_path. assert ( predicates:: str:: contains ( "Hello, world!" ) ) ;
651+ let output = std:: fs:: read_to_string ( stdout_output_path. path ( ) ) . unwrap ( ) ;
652+ assert_eq ! ( output, "Hello\n world!\n " ) ;
650653}
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ impl ToArgs for RunArgs {
145145 print_resource_usage,
146146 save_profiler_trace_data,
147147 save_program_output,
148- save_print_output : save_print_output ,
148+ save_print_output,
149149 } = self ;
150150 let mut args = arguments. to_args ( ) ;
151151 if let Some ( output) = output {
You can’t perform that action at this time.
0 commit comments