-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbb2ab2
commit c466726
Showing
26 changed files
with
91 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
tests/snapshots/ui__ui_test_err_format_flag_without_rar-1.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
14
tests/snapshots/ui__ui_test_err_format_flag_without_rar-2.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
14
tests/snapshots/ui__ui_test_err_format_flag_without_rar-3.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch decompress a b\", dir)" | |
--- | ||
[ERROR] failed to canonicalize path `a` | ||
- File not found | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch list a b\", dir)" | |
--- | ||
[ERROR] failed to canonicalize path `a` | ||
- File not found | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ expression: "run_ouch(\"ouch compress a b\", dir)" | |
--- | ||
[ERROR] failed to canonicalize path `a` | ||
- File not found | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/snapshots/ui__ui_test_ok_format_flag_without_rar-1.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
6
tests/snapshots/ui__ui_test_ok_format_flag_without_rar-2.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,3 @@ Options: | |
|
||
-V, --version | ||
Print version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.$#[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] | ||
|
@@ -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}") | ||
} |