sway
sway copied to clipboard
Reference example code running to cargo test with error
i am form China , i dont know if its network issue
this is my code
use fuels::{prelude::*, types::ContractId};
// Load abi from json
abigen!(Contract(
name = "MyContract",
abi = "out/debug/counter-contract-abi.json"
));
async fn get_contract_instance() -> (MyContract<WalletUnlocked>, ContractId) {
// Launch a local network and deploy the contract
let mut wallets = launch_custom_provider_and_get_wallets(
WalletsConfig::new(
Some(1), /* Single wallet */
Some(1), /* Single coin (UTXO) */
Some(1_000_000_000), /* Amount per coin */
),
None,
None,
)
.await
.unwrap();
let wallet = wallets.pop().unwrap();
let id = Contract::load_from(
"./out/debug/counter-contract.bin",
LoadConfiguration::default(),
)
.unwrap()
.deploy(&wallet, TxPolicies::default())
.await
.unwrap();
let instance = MyContract::new(id.clone(), wallet);
(instance, id.into())
}
#[tokio::test]
async fn can_get_contract_id() {
let (instance, _id) = get_contract_instance().await;
// Now you have an instance of your contract you can use to test each function
instance.methods().count().call().await.unwrap();
}
#[tokio::test]
async fn test_increment() {
let (instance, _id) = get_contract_instance().await;
// Increment the counter
instance.methods().increment().call().await.unwrap();
// Get the current value of the counter
let result = instance.methods().count().call().await.unwrap();
// Check that the current value of the counter is 1.
// Recall that the initial value of the counter was 0.
assert_eq!(result.value, 1);
}
this is error
cargo test
Finished test [unoptimized + debuginfo] target(s) in 1.05s
Running tests/harness.rs (target/debug/deps/integration_tests-ba92b5ecc759ead1)
running 2 tests
test can_get_contract_id ... FAILED
test test_increment ... FAILED
failures:
---- can_get_contract_id stdout ----
thread 'can_get_contract_id' panicked at tests/harness.rs:21:6:
called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: Other, error: ErrorResponse(502, "") })
---- test_increment stdout ----
thread 'test_increment' panicked at tests/harness.rs:21:6:
called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: Other, error: ErrorResponse(502, "") })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
can_get_contract_id
test_increment
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.78s
error: test failed, to rerun pass `--test integration_tests`
this is fuelup show
$ fuelup show
Default host: x86_64-apple-darwin
fuelup home: /Users/pirate/.fuelup
installed toolchains
--------------------
beta-4-x86_64-apple-darwin (default)
latest-x86_64-apple-darwin
active toolchain
----------------
beta-4-x86_64-apple-darwin (default)
forc : 0.46.1
- forc-client
- forc-deploy : 0.46.1
- forc-run : 0.46.1
- forc-crypto : not found
- forc-doc : 0.46.1
- forc-explore : 0.28.1
- forc-fmt : 0.46.1
- forc-lsp : 0.46.1
- forc-tx : 0.46.1
- forc-wallet : 0.3.0
fuel-core : 0.20.5
fuel-core-keygen : Error getting version string
fuels versions
--------------
forc : 0.45
forc-wallet : 0.45
【【公告】关于.net8版本更新后开机自启设置问题解决方案-哔哩哔哩】 https://b23.tv/UmtcpvJ
你这没删除带maa的项啊
【公告】关于.net8版本更新后开机自启设置问题解决方案-哔哩哔哩】 https://b23.tv/UmtcpvJ
你这没删除带maa的项啊
这个是已经删除过重新勾选后的了
所以注册表里的罗技 百度云 steam edge都有开机自启吗?感觉是被别的软件拦截了
所以注册表里的罗技 百度云 steam edge都有开机自启吗?感觉是被别的软件拦截了
关闭大部分其他自启动应用后依旧没用
This issue has been inactive for a prolonged period and will be closed automatically in 3 days. 该问题已长时间处于闲置状态,3 天后将自动关闭。