Skip to content

Commit

Permalink
add anyhow:error
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopgalvao committed Mar 21, 2024
1 parent 05caff8 commit 6fb3a66
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/engines/contract_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn build_smart_contract(path: &Option<PathBuf>) -> anyhow::Result<()> {
Ok(())
}

pub fn test_smart_contract(path: &Option<PathBuf>) -> anyhow::Result<()> {
pub fn (path: &Option<PathBuf>) -> anyhow::Result<()> {
cmd("cargo", vec!["test"]).dir(path.clone().unwrap_or("./".into())).run()?;

Ok(())
Expand Down Expand Up @@ -174,7 +174,7 @@ mod tests {
use std::path::PathBuf;
use tempdir::TempDir;

fn setup_test_environment() -> Result<TempDir, Box<dyn std::error::Error>> {
fn setup_test_environment() -> Result<anyhow::Result<TempDir>, anyhow::Error> {
let temp_contract_dir = TempDir::new("test_folder")?;
let result: anyhow::Result<()> = create_smart_contract("test".to_string(), &Some(PathBuf::from(temp_contract_dir.path())));
assert!(result.is_ok(), "Failed to create smart contract");
Expand All @@ -183,7 +183,7 @@ mod tests {
}

#[test]
fn test_create_smart_contract() -> Result<(), Box<dyn std::error::Error>> {
fn test_create_smart_contract() -> Result<anyhow::Result<()>, anyhow::Error> {
let temp_contract_dir = setup_test_environment()?;

// Verify that the generated smart contract contains the expected content
Expand All @@ -196,7 +196,7 @@ mod tests {
}

#[test]
fn test_test_smart_contract() -> Result<(), Box<dyn std::error::Error>> {
fn test_test_smart_contract() -> Result<anyhow::Result<()>, anyhow::Error> {
let temp_contract_dir = setup_test_environment()?;

let result = test_smart_contract(&Some(temp_contract_dir.path().join("test")));
Expand Down

0 comments on commit 6fb3a66

Please sign in to comment.