From 791ce9132d98cfff4874e9cff4278419e050d94c Mon Sep 17 00:00:00 2001 From: "Michael D. George" Date: Thu, 23 Jan 2025 17:34:22 -0500 Subject: [PATCH] [DVX-487] sui-move tests based on shell scripts (#20885) ## Description This introduces a test runner for `sui-move` that just runs shell scripts and snapshots the output. It also adds a handful of tests for `sui-move new`. ## Test plan It is tests. I did temporarily change some things locally to ensure that the tests were actually catching some errors --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: --- Cargo.lock | 20 ++++- Cargo.toml | 2 + crates/sui-move/Cargo.toml | 11 +++ crates/sui-move/src/lib.rs | 3 +- crates/sui-move/tests/cli_tests.rs | 79 +++++++++++++++++++ .../snapshots/cli_tests__dummy__dummy.sh.snap | 11 +++ ...tests__new_tests__gitignore_exists.sh.snap | 11 +++ ...ts__new_tests__gitignore_has_build.sh.snap | 18 +++++ ...ests__new_tests__manifest_template.sh.snap | 46 +++++++++++ .../cli_tests__new_tests__new_files.sh.snap | 18 +++++ ...i_tests__new_tests__new_then_build.sh.snap | 12 +++ ...li_tests__new_tests__new_then_test.sh.snap | 14 ++++ .../sui-move/tests/tests/dummy/data/data.txt | 1 + crates/sui-move/tests/tests/dummy/dummy.sh | 7 ++ .../tests/tests/new_tests/gitignore_exists.sh | 8 ++ .../tests/new_tests/gitignore_has_build.sh | 13 +++ .../tests/new_tests/manifest_template.sh | 5 ++ .../tests/tests/new_tests/new_files.sh | 11 +++ .../tests/tests/new_tests/new_then_build.sh | 18 +++++ .../tests/tests/new_tests/new_then_test.sh | 17 ++++ crates/sui-package-resolver/src/lib.rs | 4 +- .../tests/tests.rs | 2 +- crates/sui/tests/ptb_files_tests.rs | 4 +- 23 files changed, 326 insertions(+), 9 deletions(-) create mode 100644 crates/sui-move/tests/cli_tests.rs create mode 100644 crates/sui-move/tests/snapshots/cli_tests__dummy__dummy.sh.snap create mode 100644 crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_exists.sh.snap create mode 100644 crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_has_build.sh.snap create mode 100644 crates/sui-move/tests/snapshots/cli_tests__new_tests__manifest_template.sh.snap create mode 100644 crates/sui-move/tests/snapshots/cli_tests__new_tests__new_files.sh.snap create mode 100644 crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_build.sh.snap create mode 100644 crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_test.sh.snap create mode 100644 crates/sui-move/tests/tests/dummy/data/data.txt create mode 100644 crates/sui-move/tests/tests/dummy/dummy.sh create mode 100644 crates/sui-move/tests/tests/new_tests/gitignore_exists.sh create mode 100644 crates/sui-move/tests/tests/new_tests/gitignore_has_build.sh create mode 100644 crates/sui-move/tests/tests/new_tests/manifest_template.sh create mode 100644 crates/sui-move/tests/tests/new_tests/new_files.sh create mode 100644 crates/sui-move/tests/tests/new_tests/new_then_build.sh create mode 100644 crates/sui-move/tests/tests/new_tests/new_then_test.sh diff --git a/Cargo.lock b/Cargo.lock index a1ea471885656..6471462570f52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6344,9 +6344,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.26.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f0f08b46e4379744de2ab67aa8f7de3ffd1da3e275adc41fcc82053ede46ff" +checksum = "7e9ffc4d4892617c50a928c52b2961cb5174b6fc6ebf252b2fac9d21955c48b8" dependencies = [ "console", "lazy_static", @@ -6355,7 +6355,17 @@ dependencies = [ "pest_derive", "serde", "similar", - "yaml-rust", +] + +[[package]] +name = "insta-cmd" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffeeefa927925cced49ccb01bf3e57c9d4cd132df21e576eb9415baeab2d3de6" +dependencies = [ + "insta", + "serde", + "serde_json", ] [[package]] @@ -14502,7 +14512,10 @@ dependencies = [ "bin-version", "clap", "colored", + "datatest-stable", "futures", + "insta", + "insta-cmd", "jemalloc-ctl", "jsonrpsee", "move-binary-format", @@ -14532,6 +14545,7 @@ dependencies = [ "tempfile", "tokio", "tracing", + "walkdir", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 10a9938c958ba..da7a01060c7fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -370,6 +370,7 @@ indexmap = { version = "2.1.0", features = ["serde"] } indicatif = "0.17.2" inquire = "0.6.0" insta = { version = "1.21.1", features = ["redactions", "yaml", "json"] } +insta-cmd = "0.6.0" integer-encoding = "3.0.1" ipnetwork = "0.20.0" itertools = "0.13.0" @@ -536,6 +537,7 @@ unescape = "0.1.0" ureq = "2.9.1" url = "2.3.1" uuid = { version = "1.1.2", features = ["v4", "fast-rng"] } +walkdir = "2.5.0" webpki = { version = "0.102", package = "rustls-webpki", features = [ "alloc", "std", diff --git a/crates/sui-move/Cargo.toml b/crates/sui-move/Cargo.toml index f4c2c160089a3..c4c6c3dc73ef6 100644 --- a/crates/sui-move/Cargo.toml +++ b/crates/sui-move/Cargo.toml @@ -16,6 +16,7 @@ serde_yaml.workspace = true tracing.workspace = true prometheus.workspace = true bin-version.workspace = true +datatest-stable.workspace = true move-binary-format.workspace = true move-cli.workspace = true @@ -45,6 +46,9 @@ futures.workspace = true jsonrpsee.workspace = true rand.workspace = true tempfile.workspace = true +walkdir.workspace = true +insta-cmd.workspace = true +insta.workspace = true move-package.workspace = true @@ -56,3 +60,10 @@ sui-simulator.workspace = true [package.metadata.cargo-udeps.ignore] normal = ["jemalloc-ctl"] + +[[test]] +name = "cli_tests" +harness = false + +[lints] +workspace = true diff --git a/crates/sui-move/src/lib.rs b/crates/sui-move/src/lib.rs index 74b4bdc5fc4e1..b1a3ae0c81c12 100644 --- a/crates/sui-move/src/lib.rs +++ b/crates/sui-move/src/lib.rs @@ -5,7 +5,7 @@ use clap::Parser; use move_cli::base::test::UnitTestResult; use move_package::BuildConfig; use std::path::Path; -use sui_move_build::set_sui_flavor; +use sui_move_build::{set_sui_flavor, SuiPackageHooks}; pub mod build; pub mod coverage; @@ -41,6 +41,7 @@ pub fn execute_move_command( if let Some(err_msg) = set_sui_flavor(&mut build_config) { anyhow::bail!(err_msg); } + move_package::package_hooks::register_package_hooks(Box::new(SuiPackageHooks)); match command { Command::Build(c) => c.execute(package_path, build_config), Command::Coverage(c) => c.execute(package_path, build_config), diff --git a/crates/sui-move/tests/cli_tests.rs b/crates/sui-move/tests/cli_tests.rs new file mode 100644 index 0000000000000..990940433dd18 --- /dev/null +++ b/crates/sui-move/tests/cli_tests.rs @@ -0,0 +1,79 @@ +// Copyright (c) Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +use insta_cmd::get_cargo_bin; +use std::fs; +use std::path::Path; +use std::process::Command; +use walkdir::WalkDir; + +// [test_shell_snapshot] is run on every file matching [TEST_PATTERN] in [TEST_DIR]; this runs the +// files as shell scripts and compares their output to the snapshots; use `cargo insta test +// --review` to update the snapshots. + +const TEST_DIR: &str = "tests/tests"; +const TEST_PATTERN: &str = r"^test.*\.sh$"; + +/// run the bash script at [path], comparing its output to the insta snapshot of the same name. +/// The script is run in a temporary working directory that contains a copy of the parent directory +/// of [path], with the `sui-move` binary on the path. +fn test_shell_snapshot(path: &Path) -> datatest_stable::Result<()> { + // copy files into temporary directory + let srcdir = path.parent().unwrap(); + let tmpdir = tempfile::tempdir()?; + let sandbox = tmpdir.path().join("sandbox"); + + for entry in WalkDir::new(srcdir) { + let entry = entry.unwrap(); + let srcfile = entry.path(); + let dstfile = sandbox.join(srcfile.strip_prefix(srcdir)?); + if srcfile.is_dir() { + fs::create_dir_all(dstfile)?; + } else { + fs::copy(srcfile, dstfile)?; + } + } + + // set up command + let mut shell = Command::new("bash"); + shell + .env("PATH", format!("/bin:/usr/bin:{}", get_sui_move_path())) + .current_dir(sandbox) + .arg(path.file_name().unwrap()); + + // run it; snapshot test output + let output = shell.output()?; + let result = format!( + "success: {:?}\nexit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}", + output.status.success(), + output.status.code().unwrap_or(!0), + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + + let snapshot_name: String = path + .strip_prefix("tests/tests")? + .to_string_lossy() + .to_string(); + + insta::with_settings!({description => path.to_string_lossy(), omit_expression => true}, { + insta::assert_snapshot!(snapshot_name, result); + }); + + Ok(()) +} + +fn get_sui_move_path() -> String { + get_cargo_bin("sui-move") + .parent() + .unwrap() + .to_str() + .expect("directory name is valid UTF-8") + .to_owned() +} + +#[cfg(not(msim))] +datatest_stable::harness!(test_shell_snapshot, TEST_DIR, TEST_PATTERN); + +#[cfg(msim)] +fn main() {} diff --git a/crates/sui-move/tests/snapshots/cli_tests__dummy__dummy.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__dummy__dummy.sh.snap new file mode 100644 index 0000000000000..15f146522559f --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__dummy__dummy.sh.snap @@ -0,0 +1,11 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/dummy/dummy.sh +--- +success: true +exit_code: 0 +----- stdout ----- +dummy test +some dummy data + +----- stderr ----- diff --git a/crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_exists.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_exists.sh.snap new file mode 100644 index 0000000000000..98273f8ed0c71 --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_exists.sh.snap @@ -0,0 +1,11 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/new_tests/gitignore_exists.sh +--- +success: true +exit_code: 0 +----- stdout ----- +existing_ignore +build/* + +----- stderr ----- diff --git a/crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_has_build.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_has_build.sh.snap new file mode 100644 index 0000000000000..5af9fb5d7b873 --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__new_tests__gitignore_has_build.sh.snap @@ -0,0 +1,18 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/new_tests/gitignore_has_build.sh +--- +success: true +exit_code: 0 +----- stdout ----- +ignore1 +build/* +ignore2 + +==== files in example/ ==== +.gitignore +Move.toml +sources +tests + +----- stderr ----- diff --git a/crates/sui-move/tests/snapshots/cli_tests__new_tests__manifest_template.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__new_tests__manifest_template.sh.snap new file mode 100644 index 0000000000000..bd165186e9d13 --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__new_tests__manifest_template.sh.snap @@ -0,0 +1,46 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/new_tests/manifest_template.sh +--- +success: true +exit_code: 0 +----- stdout ----- +[package] +name = "example" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +example = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + + +----- stderr ----- diff --git a/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_files.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_files.sh.snap new file mode 100644 index 0000000000000..2f8a7212059dd --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_files.sh.snap @@ -0,0 +1,18 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/new_tests/new_files.sh +--- +success: true +exit_code: 0 +----- stdout ----- +==== files in project ==== +.gitignore +Move.toml +sources +tests +==== files in sources ==== +example.move +==== files in tests ===== +example_tests.move + +----- stderr ----- diff --git a/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_build.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_build.sh.snap new file mode 100644 index 0000000000000..ceff62071690e --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_build.sh.snap @@ -0,0 +1,12 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/new_tests/new_then_build.sh +--- +success: true +exit_code: 0 +----- stdout ----- + +----- stderr ----- +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING example diff --git a/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_test.sh.snap b/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_test.sh.snap new file mode 100644 index 0000000000000..63ed656458958 --- /dev/null +++ b/crates/sui-move/tests/snapshots/cli_tests__new_tests__new_then_test.sh.snap @@ -0,0 +1,14 @@ +--- +source: crates/sui-move/tests/cli_tests.rs +description: tests/tests/new_tests/new_then_test.sh +--- +success: true +exit_code: 0 +----- stdout ----- +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING example +Running Move unit tests +Test result: OK. Total tests: 0; passed: 0; failed: 0 + +----- stderr ----- diff --git a/crates/sui-move/tests/tests/dummy/data/data.txt b/crates/sui-move/tests/tests/dummy/data/data.txt new file mode 100644 index 0000000000000..5037d95904837 --- /dev/null +++ b/crates/sui-move/tests/tests/dummy/data/data.txt @@ -0,0 +1 @@ +some dummy data diff --git a/crates/sui-move/tests/tests/dummy/dummy.sh b/crates/sui-move/tests/tests/dummy/dummy.sh new file mode 100644 index 0000000000000..55dc94f21fbc1 --- /dev/null +++ b/crates/sui-move/tests/tests/dummy/dummy.sh @@ -0,0 +1,7 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# simple test just to make sure the test runner works +echo "dummy test" +cat data/data.txt +sui-move new dummy diff --git a/crates/sui-move/tests/tests/new_tests/gitignore_exists.sh b/crates/sui-move/tests/tests/new_tests/gitignore_exists.sh new file mode 100644 index 0000000000000..90bc5f8cf9d7b --- /dev/null +++ b/crates/sui-move/tests/tests/new_tests/gitignore_exists.sh @@ -0,0 +1,8 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# check that sui-move new correctly updates existing .gitignore +mkdir example +echo "existing_ignore" > example/.gitignore +sui-move new example +cat example/.gitignore diff --git a/crates/sui-move/tests/tests/new_tests/gitignore_has_build.sh b/crates/sui-move/tests/tests/new_tests/gitignore_has_build.sh new file mode 100644 index 0000000000000..4ef0230b0fee6 --- /dev/null +++ b/crates/sui-move/tests/tests/new_tests/gitignore_has_build.sh @@ -0,0 +1,13 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# sui-move new example when `example/.gitignore` already contains build/*; it should be unchanged +mkdir example +echo "ignore1" >> example/.gitignore +echo "build/*" >> example/.gitignore +echo "ignore2" >> example/.gitignore +sui-move new example +cat example/.gitignore +echo +echo ==== files in example/ ==== +ls -A example diff --git a/crates/sui-move/tests/tests/new_tests/manifest_template.sh b/crates/sui-move/tests/tests/new_tests/manifest_template.sh new file mode 100644 index 0000000000000..e8544500ab64b --- /dev/null +++ b/crates/sui-move/tests/tests/new_tests/manifest_template.sh @@ -0,0 +1,5 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +sui-move new example +cat example/Move.toml diff --git a/crates/sui-move/tests/tests/new_tests/new_files.sh b/crates/sui-move/tests/tests/new_tests/new_files.sh new file mode 100644 index 0000000000000..3f36222121448 --- /dev/null +++ b/crates/sui-move/tests/tests/new_tests/new_files.sh @@ -0,0 +1,11 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# basic test that sui-move new outputs correct files +sui-move new example +echo ==== files in project ==== +ls -A example +echo ==== files in sources ==== +ls -A example/sources +echo ==== files in tests ===== +ls -A example/tests diff --git a/crates/sui-move/tests/tests/new_tests/new_then_build.sh b/crates/sui-move/tests/tests/new_tests/new_then_build.sh new file mode 100644 index 0000000000000..13b2df54a9caf --- /dev/null +++ b/crates/sui-move/tests/tests/new_tests/new_then_build.sh @@ -0,0 +1,18 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# tests that sui-move new followed by sui-move build succeeds + +sui-move new example + +# we mangle the generated toml file to replace the framework dependency with a local dependency +FRAMEWORK_DIR=$(echo $CARGO_MANIFEST_DIR | sed 's#/crates/sui-move##g') +cat example/Move.toml \ + | sed 's#\(Sui = .*\)git = "[^"]*", \(.*\)#\1\2#' \ + | sed 's#\(Sui = .*\), rev = "[^"]*"\(.*\)#\1\2#' \ + | sed 's#\(Sui = .*\)subdir = "\([^"]*\)"\(.*\)#\1local = "FRAMEWORK/\2"\3#' \ + | sed "s#\(Sui = .*\)FRAMEWORK\(.*\)#\1$FRAMEWORK_DIR\2#" \ + > Move.toml +mv Move.toml example/Move.toml + +cd example && sui-move build diff --git a/crates/sui-move/tests/tests/new_tests/new_then_test.sh b/crates/sui-move/tests/tests/new_tests/new_then_test.sh new file mode 100644 index 0000000000000..d6ba83403a7b4 --- /dev/null +++ b/crates/sui-move/tests/tests/new_tests/new_then_test.sh @@ -0,0 +1,17 @@ +# Copyright (c) Mysten Labs, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# check that sui-move new followed by sui-move test succeeds +sui-move new example + +# we mangle the generated toml file to replace the framework dependency with a local dependency +FRAMEWORK_DIR=$(echo $CARGO_MANIFEST_DIR | sed 's#/crates/sui-move##g') +cat example/Move.toml \ + | sed 's#\(Sui = .*\)git = "[^"]*", \(.*\)#\1\2#' \ + | sed 's#\(Sui = .*\), rev = "[^"]*"\(.*\)#\1\2#' \ + | sed 's#\(Sui = .*\)subdir = "\([^"]*\)"\(.*\)#\1local = "FRAMEWORK/\2"\3#' \ + | sed "s#\(Sui = .*\)FRAMEWORK\(.*\)#\1$FRAMEWORK_DIR\2#" \ + > Move.toml +mv Move.toml example/Move.toml + +cd example && sui-move test diff --git a/crates/sui-package-resolver/src/lib.rs b/crates/sui-package-resolver/src/lib.rs index 3c21640cad7a5..847be8827dbcc 100644 --- a/crates/sui-package-resolver/src/lib.rs +++ b/crates/sui-package-resolver/src/lib.rs @@ -2450,7 +2450,7 @@ mod tests { ], ); - insta::assert_display_snapshot!( + insta::assert_snapshot!( sig.instantiate(&[T::U64, T::Bool]).unwrap_err(), @"Type Parameter 99 out of bounds (2)" ); @@ -2896,7 +2896,7 @@ mod tests { ], }; - insta::assert_display_snapshot!( + insta::assert_snapshot!( resolver.pure_input_layouts(&ptb).await.unwrap_err(), @"Conflicting types for input 3: u64 and u32" ); diff --git a/crates/sui-upgrade-compatibility-transactional-tests/tests/tests.rs b/crates/sui-upgrade-compatibility-transactional-tests/tests/tests.rs index ce1f104d25942..2450e565bac02 100644 --- a/crates/sui-upgrade-compatibility-transactional-tests/tests/tests.rs +++ b/crates/sui-upgrade-compatibility-transactional-tests/tests/tests.rs @@ -113,7 +113,7 @@ fn check_all_compatibilities( .join("\n"); results.push_str(&inclusion_results); - insta::assert_display_snapshot!(name, results); + insta::assert_snapshot!(name, results); Ok(()) } diff --git a/crates/sui/tests/ptb_files_tests.rs b/crates/sui/tests/ptb_files_tests.rs index 3defc0f26d9b1..d91784cdd5c24 100644 --- a/crates/sui/tests/ptb_files_tests.rs +++ b/crates/sui/tests/ptb_files_tests.rs @@ -41,7 +41,7 @@ async fn test_ptb_files(path: &Path) -> datatest_stable::Result<()> { for e in rendered.iter() { results.push(format!("{:?}", e)); } - insta::assert_display_snapshot!(fname(), results.join("\n")); + insta::assert_snapshot!(fname(), results.join("\n")); return Ok(()); } }; @@ -94,7 +94,7 @@ async fn test_ptb_files(path: &Path) -> datatest_stable::Result<()> { } // === FINALLY DO THE ASSERTION === - insta::assert_display_snapshot!(fname(), results.join("\n")); + insta::assert_snapshot!(fname(), results.join("\n")); Ok(()) }