update snapshots

This commit is contained in:
João Marcos P. Bezerra 2024-09-06 22:45:53 -03:00 committed by João Marcos
parent 09899389ec
commit 3d717ec3bc
26 changed files with 91 additions and 33 deletions

View File

@ -11,4 +11,3 @@ hint: ouch compress <FILES>... output.zip
hint:
hint: Alternatively, you can overwrite this option by using the '--format' flag:
hint: ouch compress <FILES>... output --format tar.gz

View File

@ -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 <TMP_DIR>/a --format tar.gz

View File

@ -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

View File

@ -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 <TMP_DIR>/b.unknown --format tar.gz

View File

@ -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 <TMP_DIR>/a --format tar.gz

View File

@ -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

View File

@ -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 <TMP_DIR>/b.unknown --format tar.gz

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress a b\", dir)"
---
[ERROR] failed to canonicalize path `a`
- File not found

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch list a b\", dir)"
---
[ERROR] failed to canonicalize path `a`
- File not found

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress a b\", dir)"
---
[ERROR] failed to canonicalize path `a`
- File not found

View File

@ -3,4 +3,3 @@ source: tests/ui.rs
expression: "run_ouch(\"ouch compress input output.gz\", dir)"
---
[INFO] Successfully compressed 'output.gz'.

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output.zip\", dir)"
---
[INFO] Compressing 'input'.
[INFO] Successfully compressed 'output.zip'.

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress output.zst\", dir)"
---
[INFO] Successfully decompressed archive in current directory.
[INFO] Files unpacked: 1

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output1 --format tar.gz\", dir)"
---
[INFO] Compressing 'input'.
[INFO] Successfully compressed 'output1'.

View File

@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output2 --format .tar.gz\", dir)"
---
[INFO] Compressing 'input'.
[INFO] Successfully compressed 'output2'.

View File

@ -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'.

View File

@ -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'.

View File

@ -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.

View File

@ -48,4 +48,3 @@ Options:
-V, --version
Print version

View File

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