Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
maciektr committed Jan 17, 2025
1 parent 8aa5b78 commit 5f22f35
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion extensions/scarb-cairo-run/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn main_inner(ui: &Ui, args: Args) -> Result<()> {
ensure!(
path.exists(),
formatdoc! {r#"
package has not been compiled, file does not exist: {filename}
package has not been compiled, file does not exist: `{filename}`
help: run `scarb build` to compile the package
"#}
);
Expand Down
4 changes: 2 additions & 2 deletions extensions/scarb-cairo-run/tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ fn build_can_be_skipped() {

#[cfg(windows)]
snapbox.stdout_eq(indoc! {r#"
error: package has not been compiled, file does not exist: hello_world.sierra.json
error: package has not been compiled, file does not exist: `hello_world.sierra.json`
help: run `scarb build` to compile the package
error: process did not exit successfully: exit code: 1
"#});
#[cfg(not(windows))]
snapbox.stdout_eq(indoc! {r#"
error: package has not been compiled, file does not exist: hello_world.sierra.json
error: package has not been compiled, file does not exist: `hello_world.sierra.json`
help: run `scarb build` to compile the package
"#});
}
Expand Down
22 changes: 11 additions & 11 deletions extensions/scarb-execute/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ pub struct ProgramArguments {

impl ProgramArguments {
pub fn read_arguments(self) -> Result<Vec<Arg>> {
Ok(if let Some(path) = self.arguments_file {
let as_vec: Vec<BigUintAsHex> = serde_json::from_reader(
fs::File::open(&path).with_context(|| "reading arguments file failed")?,
)
.with_context(|| "deserializing arguments file failed")?;
as_vec
if let Some(path) = self.arguments_file {
let file = fs::File::open(&path).with_context(|| "reading arguments file failed")?;
let as_vec: Vec<BigUintAsHex> = serde_json::from_reader(file)
.with_context(|| "deserializing arguments file failed")?;
Ok(as_vec
.into_iter()
.map(|v| Arg::Value(v.value.into()))
.collect()
.collect())
} else {
self.arguments
Ok(self
.arguments
.iter()
.map(|v| Arg::Value(v.into()))
.collect()
})
.collect())
}
}
}

Expand Down Expand Up @@ -233,7 +233,7 @@ fn main_inner(args: Args, ui: Ui) -> Result<(), anyhow::Error> {
ui.print(output_buffer.trim_end());
}

let output_dir = scarb_target_dir.join("scarb-execute");
let output_dir = scarb_target_dir.join("execute");
create_output_dir(output_dir.as_std_path())?;

if args.run.output.is_cairo_pie() {
Expand Down
4 changes: 2 additions & 2 deletions extensions/scarb-execute/tests/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn can_take_big_number_as_arg() {
Program output:
0
1129815197211541481934112806673325772687763881719835256646064516195041515616
Saving output to: target/scarb-execute/hello
Saving output to: target/execute/hello
"#});
}

Expand Down Expand Up @@ -79,6 +79,6 @@ fn can_read_arguments_from_file() {
Program output:
0
1129815197211541481934112806673325772687763881719835256646064516195041515616
Saving output to: target/scarb-execute/hello
Saving output to: target/execute/hello
"#});
}
24 changes: 12 additions & 12 deletions extensions/scarb-execute/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ fn can_execute_default_main_function_from_executable() {
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished `dev` profile target(s) in [..]
[..]Executing hello
Saving output to: target/scarb-execute/hello
Saving output to: target/execute/hello
"#});

t.child("target/scarb-execute/hello/air_private_input.json")
t.child("target/execute/hello/air_private_input.json")
.assert(predicates::path::exists());
t.child("target/scarb-execute/hello/air_public_input.json")
t.child("target/execute/hello/air_public_input.json")
.assert(predicates::path::exists());
t.child("target/scarb-execute/hello/memory.bin")
t.child("target/execute/hello/memory.bin")
.assert(predicates::path::exists());
t.child("target/scarb-execute/hello/trace.bin")
t.child("target/execute/hello/trace.bin")
.assert(predicates::path::exists());
}

Expand All @@ -62,16 +62,16 @@ fn can_execute_prebuilt_executable() {
.success()
.stdout_matches(indoc! {r#"
[..]Executing hello
Saving output to: target/scarb-execute/hello
Saving output to: target/execute/hello
"#});

t.child("target/scarb-execute/hello/air_private_input.json")
t.child("target/execute/hello/air_private_input.json")
.assert(predicates::path::exists());
t.child("target/scarb-execute/hello/air_public_input.json")
t.child("target/execute/hello/air_public_input.json")
.assert(predicates::path::exists());
t.child("target/scarb-execute/hello/memory.bin")
t.child("target/execute/hello/memory.bin")
.assert(predicates::path::exists());
t.child("target/scarb-execute/hello/trace.bin")
t.child("target/execute/hello/trace.bin")
.assert(predicates::path::exists());
}

Expand All @@ -89,10 +89,10 @@ fn can_produce_cairo_pie_output() {
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished `dev` profile target(s) in [..]
[..]Executing hello
Saving output to: target/scarb-execute/hello.zip
Saving output to: target/execute/hello.zip
"#});

t.child("target/scarb-execute/hello.zip")
t.child("target/execute/hello.zip")
.assert(predicates::path::exists());
}

Expand Down

0 comments on commit 5f22f35

Please sign in to comment.