Skip to content

Commit

Permalink
update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19 committed Sep 7, 2024
1 parent 0989938 commit 3d717ec
Show file tree
Hide file tree
Showing 26 changed files with 91 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

14 changes: 14 additions & 0 deletions tests/snapshots/ui__ui_test_err_format_flag_without_rar-1.snap
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tests/snapshots/ui__ui_test_err_format_flag_without_rar-2.snap
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tests/snapshots/ui__ui_test_err_format_flag_without_rar-3.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
source: tests/ui.rs
expression: "run_ouch(\"ouch compress input output --format .tar.$#[email protected]\", dir)"
---
[ERROR] Failed to parse `--format .tar.$#[email protected]`
- 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
1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_err_missing_files-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress a b\", dir)"
---
[ERROR] failed to canonicalize path `a`
- File not found

1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_err_missing_files-3.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch list a b\", dir)"
---
[ERROR] failed to canonicalize path `a`
- File not found

1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_err_missing_files.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress a b\", dir)"
---
[ERROR] failed to canonicalize path `a`
- File not found

1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_ok_compress-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ source: tests/ui.rs
expression: "run_ouch(\"ouch compress input output.gz\", dir)"
---
[INFO] Successfully compressed 'output.gz'.

1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_ok_compress.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output.zip\", dir)"
---
[INFO] Compressing 'input'.
[INFO] Successfully compressed 'output.zip'.

1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_ok_decompress.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress output.zst\", dir)"
---
[INFO] Successfully decompressed archive in current directory.
[INFO] Files unpacked: 1

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output1 --format tar.gz\", dir)"
---
[INFO] Compressing 'input'.
[INFO] Successfully compressed 'output1'.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress input output2 --format .tar.gz\", dir)"
---
[INFO] Compressing 'input'.
[INFO] Successfully compressed 'output2'.

6 changes: 6 additions & 0 deletions tests/snapshots/ui__ui_test_ok_format_flag_without_rar-1.snap
Original file line number Diff line number Diff line change
@@ -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'.
6 changes: 6 additions & 0 deletions tests/snapshots/ui__ui_test_ok_format_flag_without_rar-2.snap
Original file line number Diff line number Diff line change
@@ -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'.
1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_usage_help_flag-2.snap
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion tests/snapshots/ui__ui_test_usage_help_flag.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ Options:

-V, --version
Print version

53 changes: 37 additions & 16 deletions tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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.$#[email protected]", 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.$#[email protected]", dir),
);
}

#[test]
Expand All @@ -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]
Expand Down Expand Up @@ -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}")
}

0 comments on commit 3d717ec

Please sign in to comment.