From 3d717ec3bc991d713fa9398aeb79579b63bfd488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos=20P=2E=20Bezerra?= Date: Fri, 6 Sep 2024 22:45:53 -0300 Subject: [PATCH] update snapshots --- ...i_test_err_compress_missing_extension.snap | 1 - ...compress_missing_extension_with_rar-1.snap | 1 - ...compress_missing_extension_with_rar-2.snap | 1 - ...compress_missing_extension_with_rar-3.snap | 1 - ...press_missing_extension_without_rar-1.snap | 1 - ...press_missing_extension_without_rar-2.snap | 1 - ...press_missing_extension_without_rar-3.snap | 1 - ...__ui_test_err_format_flag_with_rar-1.snap} | 0 ...__ui_test_err_format_flag_with_rar-2.snap} | 0 ...__ui_test_err_format_flag_with_rar-3.snap} | 0 ...ui_test_err_format_flag_without_rar-1.snap | 14 +++++ ...ui_test_err_format_flag_without_rar-2.snap | 14 +++++ ...ui_test_err_format_flag_without_rar-3.snap | 14 +++++ .../ui__ui_test_err_missing_files-2.snap | 1 - .../ui__ui_test_err_missing_files-3.snap | 1 - .../ui__ui_test_err_missing_files.snap | 1 - .../snapshots/ui__ui_test_ok_compress-2.snap | 1 - tests/snapshots/ui__ui_test_ok_compress.snap | 1 - .../snapshots/ui__ui_test_ok_decompress.snap | 1 - ...i__ui_test_ok_format_flag_with_rar-1.snap} | 1 - ...i__ui_test_ok_format_flag_with_rar-2.snap} | 1 - ..._ui_test_ok_format_flag_without_rar-1.snap | 6 +++ ..._ui_test_ok_format_flag_without_rar-2.snap | 6 +++ .../ui__ui_test_usage_help_flag-2.snap | 1 - .../ui__ui_test_usage_help_flag.snap | 1 - tests/ui.rs | 53 +++++++++++++------ 26 files changed, 91 insertions(+), 33 deletions(-) rename tests/snapshots/{ui__ui_test_err_format_flag.snap => ui__ui_test_err_format_flag_with_rar-1.snap} (100%) rename tests/snapshots/{ui__ui_test_err_format_flag-2.snap => ui__ui_test_err_format_flag_with_rar-2.snap} (100%) rename tests/snapshots/{ui__ui_test_err_format_flag-3.snap => ui__ui_test_err_format_flag_with_rar-3.snap} (100%) create mode 100644 tests/snapshots/ui__ui_test_err_format_flag_without_rar-1.snap create mode 100644 tests/snapshots/ui__ui_test_err_format_flag_without_rar-2.snap create mode 100644 tests/snapshots/ui__ui_test_err_format_flag_without_rar-3.snap rename tests/snapshots/{ui__ui_test_ok_format_flag.snap => ui__ui_test_ok_format_flag_with_rar-1.snap} (99%) rename tests/snapshots/{ui__ui_test_ok_format_flag-2.snap => ui__ui_test_ok_format_flag_with_rar-2.snap} (99%) create mode 100644 tests/snapshots/ui__ui_test_ok_format_flag_without_rar-1.snap create mode 100644 tests/snapshots/ui__ui_test_ok_format_flag_without_rar-2.snap diff --git a/tests/snapshots/ui__ui_test_err_compress_missing_extension.snap b/tests/snapshots/ui__ui_test_err_compress_missing_extension.snap index 92fb838..1e90c3f 100644 --- a/tests/snapshots/ui__ui_test_err_compress_missing_extension.snap +++ b/tests/snapshots/ui__ui_test_err_compress_missing_extension.snap @@ -11,4 +11,3 @@ hint: ouch compress ... output.zip hint: hint: Alternatively, you can overwrite this option by using the '--format' flag: hint: ouch compress ... output --format tar.gz - diff --git a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-1.snap b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-1.snap index 19b308c..8322cf2 100644 --- a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-1.snap +++ b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-1.snap @@ -11,4 +11,3 @@ hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst hint: hint: Alternatively, you can pass an extension to the '--format' flag: hint: ouch decompress /a --format tar.gz - diff --git a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-2.snap b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-2.snap index 184634d..643702b 100644 --- a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-2.snap +++ b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-2.snap @@ -9,4 +9,3 @@ expression: "run_ouch(\"ouch decompress a b.unknown\", dir)" hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, sz, zst, rar, 7z hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst - diff --git a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-3.snap b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-3.snap index e9b9961..96a49a2 100644 --- a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-3.snap +++ b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_with_rar-3.snap @@ -11,4 +11,3 @@ hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst hint: hint: Alternatively, you can pass an extension to the '--format' flag: hint: ouch decompress /b.unknown --format tar.gz - diff --git a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-1.snap b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-1.snap index 23a3a91..fec78bb 100644 --- a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-1.snap +++ b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-1.snap @@ -11,4 +11,3 @@ hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst hint: hint: Alternatively, you can pass an extension to the '--format' flag: hint: ouch decompress /a --format tar.gz - diff --git a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-2.snap b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-2.snap index 36fd604..4ccff13 100644 --- a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-2.snap +++ b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-2.snap @@ -9,4 +9,3 @@ expression: "run_ouch(\"ouch decompress a b.unknown\", dir)" hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, sz, zst, 7z hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst - diff --git a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-3.snap b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-3.snap index 0a6cd5d..d8b9076 100644 --- a/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-3.snap +++ b/tests/snapshots/ui__ui_test_err_decompress_missing_extension_without_rar-3.snap @@ -11,4 +11,3 @@ hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst hint: hint: Alternatively, you can pass an extension to the '--format' flag: hint: ouch decompress /b.unknown --format tar.gz - diff --git a/tests/snapshots/ui__ui_test_err_format_flag.snap b/tests/snapshots/ui__ui_test_err_format_flag_with_rar-1.snap similarity index 100% rename from tests/snapshots/ui__ui_test_err_format_flag.snap rename to tests/snapshots/ui__ui_test_err_format_flag_with_rar-1.snap diff --git a/tests/snapshots/ui__ui_test_err_format_flag-2.snap b/tests/snapshots/ui__ui_test_err_format_flag_with_rar-2.snap similarity index 100% rename from tests/snapshots/ui__ui_test_err_format_flag-2.snap rename to tests/snapshots/ui__ui_test_err_format_flag_with_rar-2.snap diff --git a/tests/snapshots/ui__ui_test_err_format_flag-3.snap b/tests/snapshots/ui__ui_test_err_format_flag_with_rar-3.snap similarity index 100% rename from tests/snapshots/ui__ui_test_err_format_flag-3.snap rename to tests/snapshots/ui__ui_test_err_format_flag_with_rar-3.snap diff --git a/tests/snapshots/ui__ui_test_err_format_flag_without_rar-1.snap b/tests/snapshots/ui__ui_test_err_format_flag_without_rar-1.snap new file mode 100644 index 0000000..e386260 --- /dev/null +++ b/tests/snapshots/ui__ui_test_err_format_flag_without_rar-1.snap @@ -0,0 +1,14 @@ +--- +source: tests/ui.rs +expression: "run_ouch(\"ouch compress input output --format tar.gz.unknown\", dir)" +--- +[ERROR] Failed to parse `--format tar.gz.unknown` + - Unsupported extension 'unknown' + +hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, sz, zst, 7z +hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst +hint: +hint: Examples: +hint: --format tar +hint: --format gz +hint: --format tar.gz diff --git a/tests/snapshots/ui__ui_test_err_format_flag_without_rar-2.snap b/tests/snapshots/ui__ui_test_err_format_flag_without_rar-2.snap new file mode 100644 index 0000000..3ac4dfa --- /dev/null +++ b/tests/snapshots/ui__ui_test_err_format_flag_without_rar-2.snap @@ -0,0 +1,14 @@ +--- +source: tests/ui.rs +expression: "run_ouch(\"ouch compress input output --format targz\", dir)" +--- +[ERROR] Failed to parse `--format targz` + - Unsupported extension 'targz' + +hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, sz, zst, 7z +hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst +hint: +hint: Examples: +hint: --format tar +hint: --format gz +hint: --format tar.gz diff --git a/tests/snapshots/ui__ui_test_err_format_flag_without_rar-3.snap b/tests/snapshots/ui__ui_test_err_format_flag_without_rar-3.snap new file mode 100644 index 0000000..f317bbf --- /dev/null +++ b/tests/snapshots/ui__ui_test_err_format_flag_without_rar-3.snap @@ -0,0 +1,14 @@ +--- +source: tests/ui.rs +expression: "run_ouch(\"ouch compress input output --format .tar.$#!@.rest\", dir)" +--- +[ERROR] Failed to parse `--format .tar.$#!@.rest` + - Unsupported extension '$#!@' + +hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, sz, zst, 7z +hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst +hint: +hint: Examples: +hint: --format tar +hint: --format gz +hint: --format tar.gz diff --git a/tests/snapshots/ui__ui_test_err_missing_files-2.snap b/tests/snapshots/ui__ui_test_err_missing_files-2.snap index bfa881e..566426d 100644 --- a/tests/snapshots/ui__ui_test_err_missing_files-2.snap +++ b/tests/snapshots/ui__ui_test_err_missing_files-2.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress a b\", dir)" --- [ERROR] failed to canonicalize path `a` - File not found - diff --git a/tests/snapshots/ui__ui_test_err_missing_files-3.snap b/tests/snapshots/ui__ui_test_err_missing_files-3.snap index e88f1c3..507e8b2 100644 --- a/tests/snapshots/ui__ui_test_err_missing_files-3.snap +++ b/tests/snapshots/ui__ui_test_err_missing_files-3.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch list a b\", dir)" --- [ERROR] failed to canonicalize path `a` - File not found - diff --git a/tests/snapshots/ui__ui_test_err_missing_files.snap b/tests/snapshots/ui__ui_test_err_missing_files.snap index 549278e..32685f3 100644 --- a/tests/snapshots/ui__ui_test_err_missing_files.snap +++ b/tests/snapshots/ui__ui_test_err_missing_files.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress a b\", dir)" --- [ERROR] failed to canonicalize path `a` - File not found - diff --git a/tests/snapshots/ui__ui_test_ok_compress-2.snap b/tests/snapshots/ui__ui_test_ok_compress-2.snap index f6ff7c7..da6dd20 100644 --- a/tests/snapshots/ui__ui_test_ok_compress-2.snap +++ b/tests/snapshots/ui__ui_test_ok_compress-2.snap @@ -3,4 +3,3 @@ source: tests/ui.rs expression: "run_ouch(\"ouch compress input output.gz\", dir)" --- [INFO] Successfully compressed 'output.gz'. - diff --git a/tests/snapshots/ui__ui_test_ok_compress.snap b/tests/snapshots/ui__ui_test_ok_compress.snap index a3cf31f..93f1165 100644 --- a/tests/snapshots/ui__ui_test_ok_compress.snap +++ b/tests/snapshots/ui__ui_test_ok_compress.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output.zip\", dir)" --- [INFO] Compressing 'input'. [INFO] Successfully compressed 'output.zip'. - diff --git a/tests/snapshots/ui__ui_test_ok_decompress.snap b/tests/snapshots/ui__ui_test_ok_decompress.snap index 8fe15d3..a226ed3 100644 --- a/tests/snapshots/ui__ui_test_ok_decompress.snap +++ b/tests/snapshots/ui__ui_test_ok_decompress.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress output.zst\", dir)" --- [INFO] Successfully decompressed archive in current directory. [INFO] Files unpacked: 1 - diff --git a/tests/snapshots/ui__ui_test_ok_format_flag.snap b/tests/snapshots/ui__ui_test_ok_format_flag_with_rar-1.snap similarity index 99% rename from tests/snapshots/ui__ui_test_ok_format_flag.snap rename to tests/snapshots/ui__ui_test_ok_format_flag_with_rar-1.snap index f4f38c5..e48f9a1 100644 --- a/tests/snapshots/ui__ui_test_ok_format_flag.snap +++ b/tests/snapshots/ui__ui_test_ok_format_flag_with_rar-1.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output1 --format tar.gz\", dir)" --- [INFO] Compressing 'input'. [INFO] Successfully compressed 'output1'. - diff --git a/tests/snapshots/ui__ui_test_ok_format_flag-2.snap b/tests/snapshots/ui__ui_test_ok_format_flag_with_rar-2.snap similarity index 99% rename from tests/snapshots/ui__ui_test_ok_format_flag-2.snap rename to tests/snapshots/ui__ui_test_ok_format_flag_with_rar-2.snap index ac57ca5..aab5ab2 100644 --- a/tests/snapshots/ui__ui_test_ok_format_flag-2.snap +++ b/tests/snapshots/ui__ui_test_ok_format_flag_with_rar-2.snap @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output2 --format .tar.gz\", dir)" --- [INFO] Compressing 'input'. [INFO] Successfully compressed 'output2'. - diff --git a/tests/snapshots/ui__ui_test_ok_format_flag_without_rar-1.snap b/tests/snapshots/ui__ui_test_ok_format_flag_without_rar-1.snap new file mode 100644 index 0000000..e48f9a1 --- /dev/null +++ b/tests/snapshots/ui__ui_test_ok_format_flag_without_rar-1.snap @@ -0,0 +1,6 @@ +--- +source: tests/ui.rs +expression: "run_ouch(\"ouch compress input output1 --format tar.gz\", dir)" +--- +[INFO] Compressing 'input'. +[INFO] Successfully compressed 'output1'. diff --git a/tests/snapshots/ui__ui_test_ok_format_flag_without_rar-2.snap b/tests/snapshots/ui__ui_test_ok_format_flag_without_rar-2.snap new file mode 100644 index 0000000..aab5ab2 --- /dev/null +++ b/tests/snapshots/ui__ui_test_ok_format_flag_without_rar-2.snap @@ -0,0 +1,6 @@ +--- +source: tests/ui.rs +expression: "run_ouch(\"ouch compress input output2 --format .tar.gz\", dir)" +--- +[INFO] Compressing 'input'. +[INFO] Successfully compressed 'output2'. diff --git a/tests/snapshots/ui__ui_test_usage_help_flag-2.snap b/tests/snapshots/ui__ui_test_usage_help_flag-2.snap index f089b26..cb937d7 100644 --- a/tests/snapshots/ui__ui_test_usage_help_flag-2.snap +++ b/tests/snapshots/ui__ui_test_usage_help_flag-2.snap @@ -1,6 +1,5 @@ --- source: tests/ui.rs -assertion_line: 119 expression: "output_to_string(ouch!(\"-h\"))" --- A command-line utility for easily compressing and decompressing files and directories. diff --git a/tests/snapshots/ui__ui_test_usage_help_flag.snap b/tests/snapshots/ui__ui_test_usage_help_flag.snap index e6be8df..3b5cd8f 100644 --- a/tests/snapshots/ui__ui_test_usage_help_flag.snap +++ b/tests/snapshots/ui__ui_test_usage_help_flag.snap @@ -48,4 +48,3 @@ Options: -V, --version Print version - diff --git a/tests/ui.rs b/tests/ui.rs index 51d4dd3..e9d3508 100644 --- a/tests/ui.rs +++ b/tests/ui.rs @@ -65,17 +65,10 @@ fn ui_test_err_decompress_missing_extension() { create_files_in(dir, &["a", "b.unknown"]); - let name = { - let suffix = if cfg!(feature = "unrar") { - "with_rar" - } else { - "without_rar" - }; - format!("ui_test_err_decompress_missing_extension_{suffix}") - }; - ui!(format!("{name}-1"), run_ouch("ouch decompress a", dir)); - ui!(format!("{name}-2"), run_ouch("ouch decompress a b.unknown", dir)); - ui!(format!("{name}-3"), run_ouch("ouch decompress b.unknown", dir)); + let snapshot = concat_snapshot_filename_rar_feature("ui_test_err_decompress_missing_extension"); + ui!(format!("{snapshot}-1"), run_ouch("ouch decompress a", dir)); + ui!(format!("{snapshot}-2"), run_ouch("ouch decompress a b.unknown", dir)); + ui!(format!("{snapshot}-3"), run_ouch("ouch decompress b.unknown", dir)); } #[test] @@ -94,9 +87,19 @@ fn ui_test_err_format_flag() { // prepare create_files_in(dir, &["input"]); - ui!(run_ouch("ouch compress input output --format tar.gz.unknown", dir)); - ui!(run_ouch("ouch compress input output --format targz", dir)); - ui!(run_ouch("ouch compress input output --format .tar.$#!@.rest", dir)); + let snapshot = concat_snapshot_filename_rar_feature("ui_test_err_format_flag"); + ui!( + format!("{snapshot}-1"), + run_ouch("ouch compress input output --format tar.gz.unknown", dir), + ); + ui!( + format!("{snapshot}-2"), + run_ouch("ouch compress input output --format targz", dir), + ); + ui!( + format!("{snapshot}-3"), + run_ouch("ouch compress input output --format .tar.$#!@.rest", dir), + ); } #[test] @@ -106,8 +109,15 @@ fn ui_test_ok_format_flag() { // prepare create_files_in(dir, &["input"]); - ui!(run_ouch("ouch compress input output1 --format tar.gz", dir)); - ui!(run_ouch("ouch compress input output2 --format .tar.gz", dir)); + let snapshot = concat_snapshot_filename_rar_feature("ui_test_ok_format_flag"); + ui!( + format!("{snapshot}-1"), + run_ouch("ouch compress input output1 --format tar.gz", dir), + ); + ui!( + format!("{snapshot}-2"), + run_ouch("ouch compress input output2 --format .tar.gz", dir), + ); } #[test] @@ -142,3 +152,14 @@ fn ui_test_usage_help_flag() { ui!(output_to_string(ouch!("-h"))); }); } + +/// Concatenates `with_rar` or `without_rar` if the feature is toggled or not. +fn concat_snapshot_filename_rar_feature(name: &str) -> String { + let suffix = if cfg!(feature = "unrar") { + "with_rar" + } else { + "without_rar" + }; + + format!("{name}_{suffix}") +}