From 1fc10adee0664103f4009ec938f609d93e2597e7 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:09:06 +0100 Subject: [PATCH] fix: actually run all unit tests in CI --- .github/scripts/matrices.py | 2 +- crates/cast/bin/cmd/call.rs | 8 ++--- crates/forge/bin/cmd/install.rs | 1 + crates/forge/bin/cmd/script/mod.rs | 33 ++++++++------------ crates/forge/bin/cmd/verify/etherscan/mod.rs | 4 +-- 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/.github/scripts/matrices.py b/.github/scripts/matrices.py index 090ca98bd3ef..3594fd267314 100755 --- a/.github/scripts/matrices.py +++ b/.github/scripts/matrices.py @@ -76,7 +76,7 @@ def __init__( config = [ Case( name="unit", - filter="kind(lib) | kind(bench) | kind(proc-macro)", + filter="!kind(test)", n_partitions=1, pr_cross_platform=True, ), diff --git a/crates/cast/bin/cmd/call.rs b/crates/cast/bin/cmd/call.rs index 5845b721018b..4851e9cf9a6f 100644 --- a/crates/cast/bin/cmd/call.rs +++ b/crates/cast/bin/cmd/call.rs @@ -254,11 +254,11 @@ mod tests { #[test] fn can_parse_call_data() { let data = hex::encode("hello"); - let args: CallArgs = - CallArgs::parse_from(["foundry-cli", "--data", format!("0x{data}").as_str()]); - assert_eq!(args.data, Some(data.clone())); + let args = CallArgs::parse_from(["foundry-cli", "--data", data.as_str()]); + assert_eq!(args.data, Some(data)); - let args: CallArgs = CallArgs::parse_from(["foundry-cli", "--data", data.as_str()]); + let data = hex::encode_prefixed("hello"); + let args = CallArgs::parse_from(["foundry-cli", "--data", data.as_str()]); assert_eq!(args.data, Some(data)); } diff --git a/crates/forge/bin/cmd/install.rs b/crates/forge/bin/cmd/install.rs index 140cd7b5a5b1..a990c4a91004 100644 --- a/crates/forge/bin/cmd/install.rs +++ b/crates/forge/bin/cmd/install.rs @@ -505,6 +505,7 @@ mod tests { use tempfile::tempdir; #[test] + #[ignore = "slow"] fn get_oz_tags() { let tmp = tempdir().unwrap(); let git = Git::new(tmp.path()); diff --git a/crates/forge/bin/cmd/script/mod.rs b/crates/forge/bin/cmd/script/mod.rs index 5ea7119a93ec..ede0b19fd388 100644 --- a/crates/forge/bin/cmd/script/mod.rs +++ b/crates/forge/bin/cmd/script/mod.rs @@ -703,21 +703,14 @@ mod tests { #[test] fn can_parse_sig() { - let args: ScriptArgs = ScriptArgs::parse_from([ - "foundry-cli", - "Contract.sol", - "--sig", - "0x522bb704000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfFFb92266", - ]); - assert_eq!( - args.sig, - "522bb704000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfFFb92266" - ); + let sig = "0x522bb704000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfFFb92266"; + let args = ScriptArgs::parse_from(["foundry-cli", "Contract.sol", "--sig", sig]); + assert_eq!(args.sig, sig); } #[test] fn can_parse_unlocked() { - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "Contract.sol", "--sender", @@ -741,7 +734,7 @@ mod tests { #[test] fn can_merge_script_config() { - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "Contract.sol", "--etherscan-api-key", @@ -753,7 +746,7 @@ mod tests { #[test] fn can_parse_verifier_url() { - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "script", "script/Test.s.sol:TestScript", @@ -775,7 +768,7 @@ mod tests { #[test] fn can_extract_code_size_limit() { - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "script", "script/Test.s.sol:TestScript", @@ -803,7 +796,7 @@ mod tests { let toml_file = root.join(Config::FILE_NAME); fs::write(toml_file, config).unwrap(); - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "Contract.sol", "--etherscan-api-key", @@ -831,7 +824,7 @@ mod tests { let toml_file = root.join(Config::FILE_NAME); fs::write(toml_file, config).unwrap(); - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "DeployV1", "--rpc-url", @@ -870,7 +863,7 @@ mod tests { let toml_file = root.join(Config::FILE_NAME); fs::write(toml_file, config).unwrap(); - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "DeployV1", "--rpc-url", @@ -915,7 +908,7 @@ mod tests { let toml_file = root.join(Config::FILE_NAME); fs::write(toml_file, config).unwrap(); - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "DeployV1", "--rpc-url", @@ -943,7 +936,7 @@ mod tests { // #[test] fn test_5923() { - let args: ScriptArgs = + let args = ScriptArgs::parse_from(["foundry-cli", "DeployV1", "--priority-gas-price", "100"]); assert!(args.priority_gas_price.is_some()); } @@ -951,7 +944,7 @@ mod tests { // #[test] fn test_5910() { - let args: ScriptArgs = ScriptArgs::parse_from([ + let args = ScriptArgs::parse_from([ "foundry-cli", "--broadcast", "--with-gas-price", diff --git a/crates/forge/bin/cmd/verify/etherscan/mod.rs b/crates/forge/bin/cmd/verify/etherscan/mod.rs index 2304871941c5..e973189036fb 100644 --- a/crates/forge/bin/cmd/verify/etherscan/mod.rs +++ b/crates/forge/bin/cmd/verify/etherscan/mod.rs @@ -512,7 +512,7 @@ mod tests { &config, ) .unwrap(); - assert_eq!(client.etherscan_api_url().as_str(), "https://api-testnet.polygonscan.com/?/"); + assert_eq!(client.etherscan_api_url().as_str(), "https://api-testnet.polygonscan.com/"); assert!(format!("{client:?}").contains("dummykey")); @@ -539,7 +539,7 @@ mod tests { &config, ) .unwrap(); - assert_eq!(client.etherscan_api_url().as_str(), "https://verifier-url.com/?/"); + assert_eq!(client.etherscan_api_url().as_str(), "https://verifier-url.com/"); assert!(format!("{client:?}").contains("dummykey")); }