Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: actually run all unit tests in CI #6989

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
8 changes: 4 additions & 4 deletions crates/cast/bin/cmd/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
mattsse marked this conversation as resolved.
Show resolved Hide resolved

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));
}

Expand Down
1 change: 1 addition & 0 deletions crates/forge/bin/cmd/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ mod tests {
use tempfile::tempdir;

#[test]
#[ignore = "slow"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really want these tests in unit tests, same for some that call providers or fork.

fn get_oz_tags() {
let tmp = tempdir().unwrap();
let git = Git::new(tmp.path());
Expand Down
33 changes: 13 additions & 20 deletions crates/forge/bin/cmd/script/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefix again

}

#[test]
fn can_parse_unlocked() {
let args: ScriptArgs = ScriptArgs::parse_from([
let args = ScriptArgs::parse_from([
"foundry-cli",
"Contract.sol",
"--sender",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -943,15 +936,15 @@ mod tests {
// <https://github.com/foundry-rs/foundry/issues/5923>
#[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());
}

// <https://github.com/foundry-rs/foundry/issues/5910>
#[test]
fn test_5910() {
let args: ScriptArgs = ScriptArgs::parse_from([
let args = ScriptArgs::parse_from([
"foundry-cli",
"--broadcast",
"--with-gas-price",
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/bin/cmd/verify/etherscan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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/");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know what this is about

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outdated/no longer required, there were some cloudflare bugs with trailing /


assert!(format!("{client:?}").contains("dummykey"));

Expand All @@ -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"));
}

Expand Down
Loading