Skip to content

Commit 0febca1

Browse files
Copilotcptartur
andcommitted
Fix compilation errors from dependency upgrades: snapbox and toml_edit
Co-authored-by: cptartur <52135326+cptartur@users.noreply.github.com>
1 parent 2140248 commit 0febca1

File tree

19 files changed

+80
-78
lines changed

19 files changed

+80
-78
lines changed

crates/forge/tests/e2e/common/runner.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use camino::Utf8PathBuf;
99
use indoc::formatdoc;
1010
use shared::command::CommandExt;
1111
use shared::test_utils::node_url::node_rpc_url;
12-
use snapbox::cmd::{Command as SnapboxCommand, cargo_bin};
12+
use snapbox::cargo_bin;
13+
use snapbox::cmd::Command as SnapboxCommand;
1314
use std::path::{Path, PathBuf};
1415
use std::process::Command;
1516
use std::str::FromStr;

crates/forge/tests/e2e/new.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use regex::Regex;
1111
use scarb_api::ScarbCommand;
1212
use shared::consts::FREE_RPC_PROVIDER_URL;
1313
use shared::test_utils::output_assert::assert_stdout_contains;
14-
use snapbox::assert_matches;
14+
use snapbox::assert_data_eq;
1515
use snapbox::cmd::Command as SnapboxCommand;
1616
use std::ffi::OsString;
1717
use std::path::{Path, PathBuf};
@@ -348,5 +348,5 @@ fn assert_manifest_matches(expected: &str, actual: &str) {
348348
s.lines().sorted().join("\n")
349349
}
350350

351-
assert_matches(sort_lines(expected), sort_lines(actual));
351+
assert_data_eq!(sort_lines(actual), sort_lines(expected));
352352
}

crates/forge/tests/e2e/plugin_versions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use scarb_api::ScarbCommand;
66
use scarb_api::version::scarb_version_for_dir;
77
use shared::test_utils::output_assert::assert_stdout_contains;
88
use snapbox::cmd::Command;
9-
use toml_edit::ImDocument;
9+
use toml_edit::Document;
1010

1111
#[test]
1212
#[cfg_attr(
@@ -23,7 +23,7 @@ fn new_with_new_scarb() {
2323

2424
let manifest = temp.path().join("abc").join("Scarb.toml");
2525
let manifest = &std::fs::read_to_string(manifest).unwrap();
26-
let manifest = ImDocument::parse(manifest).unwrap();
26+
let manifest = Document::parse(manifest).unwrap();
2727

2828
let snforge_std = manifest
2929
.get("dev-dependencies")
@@ -62,7 +62,7 @@ fn new_with_old_scarb() {
6262

6363
let manifest = temp.path().join("abc").join("Scarb.toml");
6464
let manifest = &std::fs::read_to_string(manifest).unwrap();
65-
let manifest = ImDocument::parse(manifest).unwrap();
65+
let manifest = Document::parse(manifest).unwrap();
6666

6767
let snforge_std = manifest
6868
.get("dev-dependencies")

crates/sncast/tests/e2e/account/create.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use serde_json::{json, to_string_pretty};
1111
use shared::test_utils::output_assert::{
1212
AsOutput, assert_stderr_contains, assert_stdout, assert_stdout_contains,
1313
};
14-
use snapbox::assert_matches;
14+
use snapbox::assert_data_eq;
1515
use sncast::AccountType;
1616
use sncast::helpers::constants::{
1717
BRAAVOS_BASE_ACCOUNT_CLASS_HASH, BRAAVOS_CLASS_HASH, OZ_CLASS_HASH, READY_CLASS_HASH,
@@ -85,7 +85,7 @@ pub async fn test_happy_case(account_type: &str) {
8585
}
8686
);
8787

88-
assert_matches(to_string_pretty(&expected).unwrap(), contents);
88+
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
8989
}
9090

9191
// TODO(#3556): Remove this test once we drop Argent account type
@@ -153,7 +153,7 @@ pub async fn test_happy_case_argent_with_deprecation_warning() {
153153
}
154154
);
155155

156-
assert_matches(to_string_pretty(&expected).unwrap(), contents);
156+
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
157157
}
158158

159159
#[tokio::test]
@@ -214,7 +214,7 @@ pub async fn test_happy_case_generate_salt() {
214214
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
215215
.current_dir(temp_dir.path());
216216

217-
snapbox.assert().success().stdout_matches(indoc! {r"
217+
snapbox.assert().success().stdout_eq(indoc! {r"
218218
Success: Account created
219219
220220
Address: 0x0[..]
@@ -302,7 +302,7 @@ pub async fn test_happy_case_accounts_file_already_exists() {
302302
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
303303
.current_dir(temp_dir.path());
304304

305-
snapbox.assert().success().stdout_matches(indoc! {r"
305+
snapbox.assert().success().stdout_eq(indoc! {r"
306306
Success: Account created
307307
308308
Address: 0x0[..]
@@ -436,7 +436,7 @@ pub async fn test_happy_case_keystore(account_type: &str) {
436436
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
437437
.current_dir(temp_dir.path());
438438

439-
snapbox.assert().stdout_matches(formatdoc! {r"
439+
snapbox.assert().stdout_eq(formatdoc! {r"
440440
Success: Account created
441441
442442
Address: 0x0[..]
@@ -455,9 +455,9 @@ pub async fn test_happy_case_keystore(account_type: &str) {
455455
let contents = fs::read_to_string(temp_dir.path().join(account_file))
456456
.expect("Unable to read created file");
457457

458-
assert_matches(
459-
get_keystore_account_pattern(account_type.parse().unwrap(), None),
458+
assert_data_eq!(
460459
contents,
460+
get_keystore_account_pattern(account_type.parse().unwrap(), None),
461461
);
462462
}
463463

@@ -486,7 +486,7 @@ pub async fn test_happy_case_keystore_argent_with_deprecation_warning() {
486486
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
487487
.current_dir(temp_dir.path());
488488

489-
snapbox.assert().stdout_matches(formatdoc! {r"
489+
snapbox.assert().stdout_eq(formatdoc! {r"
490490
[WARNING] Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account create` is deprecated, please use `ready` instead.
491491
492492
Success: Account created
@@ -507,9 +507,9 @@ pub async fn test_happy_case_keystore_argent_with_deprecation_warning() {
507507
let contents = fs::read_to_string(temp_dir.path().join(account_file))
508508
.expect("Unable to read created file");
509509

510-
assert_matches(
511-
get_keystore_account_pattern("argent".parse().unwrap(), None),
510+
assert_data_eq!(
512511
contents,
512+
get_keystore_account_pattern("argent".parse().unwrap(), None),
513513
);
514514
}
515515

@@ -692,7 +692,7 @@ pub async fn test_happy_case_keystore_int_format() {
692692
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
693693
.current_dir(temp_dir.path());
694694

695-
snapbox.assert().stdout_matches(formatdoc! {r"
695+
snapbox.assert().stdout_eq(formatdoc! {r"
696696
Success: Account created
697697
698698
Address: [..]
@@ -746,7 +746,7 @@ pub async fn test_happy_case_default_name_generation() {
746746
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
747747
.current_dir(tempdir.path())
748748
.assert()
749-
.stdout_matches(formatdoc! {r"
749+
.stdout_eq(formatdoc! {r"
750750
Success: Account created
751751
752752
Address: 0x0[..]
@@ -779,7 +779,7 @@ pub async fn test_happy_case_default_name_generation() {
779779
.stdin("Y")
780780
.assert()
781781
.success()
782-
.stdout_matches(indoc! {r"
782+
.stdout_eq(indoc! {r"
783783
Success: Account deleted
784784
785785
Account successfully removed
@@ -834,7 +834,7 @@ pub async fn test_happy_case_default_name_generation() {
834834
}
835835
);
836836

837-
assert_matches(to_string_pretty(&expected).unwrap(), contents);
837+
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
838838
}
839839

840840
fn get_formatted_account_type(account_type: &str) -> &str {
@@ -1010,7 +1010,7 @@ pub async fn test_json_output_format() {
10101010
let snapbox = runner(&args)
10111011
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
10121012
.current_dir(temp_dir.path());
1013-
snapbox.assert().stdout_matches(indoc! {r#"
1013+
snapbox.assert().stdout_eq(indoc! {r#"
10141014
{"add_profile":"Profile my_account successfully added to [..]/snfoundry.toml","address":"0x[..]","command":"account create","estimated_fee":"[..]","message":"Account successfully created but it needs to be deployed. The estimated deployment fee is [..] STRK. Prefund the account to cover deployment transaction fee/n/nAfter prefunding the account, run:/nsncast --accounts-file accounts.json account deploy --url [..] --name my_account","type":"response"}
10151015
{"links":"account: https://sepolia.starkscan.co/contract/0x[..]","title":"account creation","type":"notification"}
10161016
"#});

crates/sncast/tests/e2e/account/delete.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub fn test_happy_case() {
106106
// Run test with an affirmative user input
107107
let snapbox = runner(&args).current_dir(temp_dir.path()).stdin("Y");
108108

109-
snapbox.assert().success().stdout_matches(indoc! {r"
109+
snapbox.assert().success().stdout_eq(indoc! {r"
110110
Success: Account deleted
111111
112112
Account successfully removed
@@ -131,7 +131,7 @@ pub fn test_happy_case_url() {
131131

132132
let snapbox = runner(&args).current_dir(temp_dir.path()).stdin("Y");
133133

134-
snapbox.assert().success().stdout_matches(indoc! {r"
134+
snapbox.assert().success().stdout_eq(indoc! {r"
135135
Success: Account deleted
136136
137137
Account successfully removed
@@ -162,7 +162,7 @@ pub fn test_happy_case_with_yes_flag() {
162162
let output = snapbox.assert().success();
163163

164164
assert!(output.as_stderr().is_empty());
165-
output.stdout_matches(indoc! {r"
165+
output.stdout_eq(indoc! {r"
166166
Success: Account deleted
167167
168168
Account successfully removed

crates/sncast/tests/e2e/account/deploy.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub async fn test_valid_class_hash() {
181181
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
182182
.current_dir(tempdir.path());
183183

184-
snapbox.assert().success().stdout_matches(indoc! {r"
184+
snapbox.assert().success().stdout_eq(indoc! {r"
185185
Success: Account deployed
186186
187187
Transaction Hash: 0x[..]
@@ -213,7 +213,7 @@ pub async fn test_valid_no_max_fee() {
213213
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
214214
.current_dir(tempdir.path());
215215

216-
snapbox.assert().success().stdout_matches(indoc! {r"
216+
snapbox.assert().success().stdout_eq(indoc! {r"
217217
Success: Account deployed
218218
219219
Transaction Hash: 0x[..]
@@ -311,7 +311,7 @@ pub async fn test_happy_case_keystore(account_type: &str) {
311311
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
312312
.current_dir(tempdir.path());
313313

314-
snapbox.assert().stdout_matches(indoc! {r"
314+
snapbox.assert().stdout_eq(indoc! {r"
315315
Success: Account deployed
316316
317317
Transaction Hash: 0x[..]
@@ -576,7 +576,7 @@ pub async fn test_deploy_keystore_other_args() {
576576
let snapbox = runner(&args)
577577
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
578578
.current_dir(tempdir.path());
579-
snapbox.assert().stdout_matches(indoc! {r"
579+
snapbox.assert().stdout_eq(indoc! {r"
580580
Success: Account deployed
581581
582582
Transaction Hash: 0x[..]
@@ -607,7 +607,7 @@ pub async fn test_json_output_format() {
607607
let snapbox = runner(&args)
608608
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
609609
.current_dir(tempdir.path());
610-
snapbox.assert().stdout_matches(indoc! {r#"
610+
snapbox.assert().stdout_eq(indoc! {r#"
611611
{"command":"account deploy","transaction_hash":"0x0[..]","type":"response"}
612612
{"links":"transaction: https://sepolia.starkscan.co/tx/0x0[..]","title":"account deployment","type":"notification"}
613613
"#});

crates/sncast/tests/e2e/account/import.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub async fn test_happy_case(input_account_type: &str, saved_type: &str) {
4242

4343
let snapbox = runner(&args).current_dir(tempdir.path());
4444

45-
snapbox.assert().stdout_matches(indoc! {r"
45+
snapbox.assert().stdout_eq(indoc! {r"
4646
Success: Account imported successfully
4747
4848
Account Name: my_account_import
@@ -98,7 +98,7 @@ pub async fn test_happy_case_argent_with_deprecation_warning() {
9898

9999
let snapbox = runner(&args).current_dir(tempdir.path());
100100

101-
snapbox.assert().stdout_matches(indoc! {r"
101+
snapbox.assert().stdout_eq(indoc! {r"
102102
[WARNING] Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account import` is deprecated, please use `ready` instead.
103103
104104
Success: Account imported successfully
@@ -202,7 +202,7 @@ pub async fn test_existent_account_address_and_incorrect_class_hash() {
202202

203203
let snapbox = runner(&args).current_dir(tempdir.path());
204204

205-
snapbox.assert().stderr_matches(formatdoc! {r"
205+
snapbox.assert().stderr_eq(formatdoc! {r"
206206
Command: account import
207207
Error: Incorrect class hash {} for account address {} was provided
208208
", DEVNET_OZ_CLASS_HASH_CAIRO_0, DEVNET_PREDEPLOYED_ACCOUNT_ADDRESS});
@@ -234,7 +234,7 @@ pub async fn test_nonexistent_account_address_and_nonexistent_class_hash() {
234234

235235
let snapbox = runner(&args).current_dir(tempdir.path());
236236

237-
snapbox.assert().stderr_matches(indoc! {r"
237+
snapbox.assert().stderr_eq(indoc! {r"
238238
Command: account import
239239
Error: Class with hash 0x101 is not declared, try using --class-hash with a hash of the declared class
240240
"});
@@ -264,7 +264,7 @@ pub async fn test_nonexistent_account_address() {
264264

265265
let snapbox = runner(&args).current_dir(tempdir.path());
266266

267-
snapbox.assert().stderr_matches(indoc! {r"
267+
snapbox.assert().stderr_eq(indoc! {r"
268268
Command: account import
269269
Error: Class hash for the account address 0x123 could not be found. Please provide the class hash
270270
"});
@@ -399,7 +399,7 @@ pub async fn test_detect_deployed() {
399399

400400
let snapbox = runner(&args).current_dir(tempdir.path());
401401

402-
snapbox.assert().stdout_matches(indoc! {r"
402+
snapbox.assert().stdout_eq(indoc! {r"
403403
Success: Account imported successfully
404404
405405
Account Name: my_account_import
@@ -481,7 +481,7 @@ pub async fn test_private_key_from_file() {
481481

482482
let snapbox = runner(&args).current_dir(temp_dir.path());
483483

484-
snapbox.assert().stdout_matches(indoc! {r"
484+
snapbox.assert().stdout_eq(indoc! {r"
485485
Success: Account imported successfully
486486
487487
Account Name: my_account_import
@@ -731,7 +731,7 @@ pub async fn test_happy_case_valid_address_computation() {
731731

732732
let snapbox = runner(&args).current_dir(tempdir.path());
733733

734-
snapbox.assert().stdout_matches(indoc! {r"
734+
snapbox.assert().stdout_eq(indoc! {r"
735735
Success: Account imported successfully
736736
737737
Account Name: my_account_import
@@ -789,7 +789,7 @@ pub async fn test_invalid_address_computation() {
789789

790790
let snapbox = runner(&args).current_dir(tempdir.path());
791791
let computed_address = "0xaf550326d32c8106ef08d25cbc0dba06e5cd10a2201c2e9bc5ad4cbbce45e6";
792-
snapbox.assert().stderr_matches(formatdoc! {r"
792+
snapbox.assert().stderr_eq(formatdoc! {r"
793793
Command: account import
794794
Error: Computed address {computed_address} does not match the provided address 0x123. Please ensure that the provided salt, class hash, and account type are correct.
795795
"});
@@ -849,7 +849,7 @@ pub async fn test_happy_case_default_name_generation() {
849849

850850
for i in 0..3 {
851851
let snapbox = runner(&import_args).current_dir(tempdir.path());
852-
snapbox.assert().stdout_matches(formatdoc! {r"
852+
snapbox.assert().stdout_eq(formatdoc! {r"
853853
Success: Account imported successfully
854854
855855
Account Name: account-{id}
@@ -863,7 +863,7 @@ pub async fn test_happy_case_default_name_generation() {
863863
assert_eq!(contents_json, all_accounts_content);
864864

865865
let snapbox = runner(&delete_args).current_dir(tempdir.path()).stdin("Y");
866-
snapbox.assert().success().stdout_matches(indoc! {r"
866+
snapbox.assert().success().stdout_eq(indoc! {r"
867867
Success: Account deleted
868868
869869
Account successfully removed
@@ -876,7 +876,7 @@ pub async fn test_happy_case_default_name_generation() {
876876
assert_eq!(contents_json, accounts_content_after_delete);
877877

878878
let snapbox = runner(&import_args).current_dir(tempdir.path());
879-
snapbox.assert().stdout_matches(indoc! {r"
879+
snapbox.assert().stdout_eq(indoc! {r"
880880
Success: Account imported successfully
881881
882882
Account Name: account-2

0 commit comments

Comments
 (0)