Skip to content

Commit

Permalink
generic fail & clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasir shariff committed Nov 7, 2023
1 parent 5bea7e0 commit 9e16afa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions workspaces/tests/cross_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ async fn test_cross_contract_create_contract() -> anyhow::Result<()> {
.into_result()?;
let status_amt = NearToken::from_near(35);

// Expect the creation of a top level account to fail.
let status_id: AccountId = "status-top-level-account-long-name".parse().unwrap();
let outcome = cross_contract_create_contract(&status_id, &status_amt, &contract).await?;
let failures = outcome.failures();
assert!(
failures.len() == 1,
"Expected one receipt failure for creating a top level account, but got {} failures",
failures.len()
);
#[cfg(feature = "experimental")]
if let Ok(conf) = worker.genesis_config().await {
if conf.protocol_version >= 64 {
// Expect the creation of a top level account to fail.
let status_id: AccountId = "status-top-level-account-long-name".parse().unwrap();
let outcome =
cross_contract_create_contract(&status_id, &status_amt, &contract).await?;
let failures = outcome.failures();
assert!(
failures.len() == 1,
"Expected one receipt failure for creating a top level account, but got {} failures",
failures.len()
);
}
}

// Expect the creation of a subaccount like "status.{contract_id}" to pass.
let status_id: AccountId = format!("status.{}", contract.id()).parse().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion workspaces/tests/gas_meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,6 @@ async fn test_dropped_gas_meter() -> anyhow::Result<()> {
Ok(())
}

fn as_near(gas: Gas) -> NearToken {
const fn as_near(gas: Gas) -> NearToken {
NearToken::from_yoctonear(gas.as_gas() as u128)
}

0 comments on commit 9e16afa

Please sign in to comment.