Skip to content

Commit

Permalink
cargo +nightly fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Dec 24, 2024
1 parent 45412f8 commit 961a43b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
5 changes: 4 additions & 1 deletion crates/pop-cli/src/commands/build/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-3.0

use crate::{common::contracts::get_project_path, cli::{self, Cli}};
use crate::{
cli::{self, Cli},
common::contracts::get_project_path,
};
use clap::{Args, Subcommand};
#[cfg(feature = "contract")]
use contract::BuildContract;
Expand Down
10 changes: 5 additions & 5 deletions crates/pop-cli/src/commands/call/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{
cli::{self, traits::*},
common::{
contracts::{has_contract_been_built, get_project_path},
contracts::{get_project_path, has_contract_been_built},
wallet::{prompt_to_use_wallet, request_signature},
},
};
Expand Down Expand Up @@ -115,10 +115,10 @@ impl CallContractCommand {

if let Some(path) = &self.path {
full_message.push_str(&format!(" --path {}", path.display()));
}
if let Some(path_pos) = &self.path_pos {
}
if let Some(path_pos) = &self.path_pos {
full_message.push_str(&format!(" --path {}", path_pos.display()));
}
}
if let Some(contract) = &self.contract {
full_message.push_str(&format!(" --contract {}", contract));
}
Expand Down Expand Up @@ -791,7 +791,7 @@ mod tests {
true,
Some(items),
1, // "get" message
)
)
.expect_input(
"Where is your contract deployed?",
"wss://rpc1.paseo.popnetwork.xyz".into(),
Expand Down
5 changes: 4 additions & 1 deletion crates/pop-cli/src/commands/up/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
use crate::{
cli::{traits::Cli as _, Cli},
common::{
contracts::{check_contracts_node_and_prompt, has_contract_been_built, terminate_node, get_project_path},
contracts::{
check_contracts_node_and_prompt, get_project_path, has_contract_been_built,
terminate_node,
},
wallet::request_signature,
},
style::style,
Expand Down
1 change: 0 additions & 1 deletion crates/pop-cli/src/common/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ pub fn has_contract_been_built(path: Option<&Path>) -> bool {
.unwrap_or_default()
}


pub fn get_project_path(path_flag: Option<PathBuf>, path_pos: Option<PathBuf>) -> Option<PathBuf> {
let project_path = if let Some(ref path) = path_pos {
Some(path) // Use positional path if present
Expand Down
17 changes: 8 additions & 9 deletions crates/pop-cli/tests/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ async fn contract_lifecycle() -> Result<()> {
.success();
assert!(temp_dir.join("test_contract").exists());

// pop build --path ./test_contract --release
Command::cargo_bin("pop")
.unwrap()
.current_dir(&temp_dir)
.args(&["build", "--path", "./test_contract", "--release"])
.assert()
.success();


// pop build --path ./test_contract --release
Command::cargo_bin("pop")
.unwrap()
.current_dir(&temp_dir)
.args(&["build", "--path", "./test_contract", "--release"])
.assert()
.success();

// Verify that the directory target has been created
assert!(temp_dir.join("test_contract/target").exists());
// Verify that all the artifacts has been generated
Expand Down

0 comments on commit 961a43b

Please sign in to comment.