mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 12:28:13 -04:00
test: more mkdwarfs option tests
This commit is contained in:
parent
0a0be0ce6f
commit
01065f92aa
@ -857,16 +857,16 @@ int mkdwarfs_main(int argc, sys_char** argv, iolayer const& iol) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!progress_modes.count(progress_mode)) {
|
||||
iol.err << "error: invalid progress mode '" << progress_mode << "'\n";
|
||||
return 1;
|
||||
}
|
||||
if (no_progress) {
|
||||
progress_mode = "none";
|
||||
}
|
||||
if (progress_mode != "none" && !iol.term->is_fancy(iol.err)) {
|
||||
progress_mode = "simple";
|
||||
}
|
||||
if (!progress_modes.count(progress_mode)) {
|
||||
iol.err << "error: invalid progress mode '" << progress_mode << "'\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto pg_mode = DWARFS_NOTHROW(progress_modes.at(progress_mode));
|
||||
auto log_level = logger::parse_level(log_level_str);
|
||||
|
@ -749,12 +749,12 @@ TEST_P(mkdwarfs_build_options_test, basic) {
|
||||
namespace {
|
||||
|
||||
constexpr std::array<std::string_view, 7> const build_options = {
|
||||
"--categorize --order=none",
|
||||
"--categorize --order=none --file-hash=none",
|
||||
"--categorize=pcmaudio --order=path",
|
||||
"--categorize --order=revpath --file-hash=sha512",
|
||||
"--categorize=pcmaudio,incompressible --order=similarity",
|
||||
"--categorize --order=nilsimsa",
|
||||
"--categorize --order=nilsimsa:16",
|
||||
"--categorize --order=nilsimsa --time-resolution=30",
|
||||
"--categorize --order=nilsimsa:16 --time-resolution=hour",
|
||||
"--categorize --order=nilsimsa:16:16 --max-similarity-size=1M",
|
||||
};
|
||||
|
||||
@ -788,6 +788,44 @@ TEST(mkdwarfs_test, order_nilsimsa_cannot_be_less) {
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("cannot be less than 0 for order"));
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, unknown_file_hash) {
|
||||
mkdwarfs_tester t;
|
||||
EXPECT_NE(0, t.run({"-i", "/", "-o", "-", "--file-hash=grmpf"}));
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("unknown file hash function"));
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, invalid_filter_debug_mode) {
|
||||
mkdwarfs_tester t;
|
||||
EXPECT_NE(0, t.run({"-i", "/", "-o", "-", "--debug-filter=grmpf"}));
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("invalid filter debug mode"));
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, invalid_progress_mode) {
|
||||
mkdwarfs_tester t;
|
||||
t.iol->set_terminal_fancy(true);
|
||||
EXPECT_NE(0, t.run({"-i", "/", "-o", "-", "--progress=grmpf"}));
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("invalid progress mode"));
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, invalid_filter_rule) {
|
||||
mkdwarfs_tester t;
|
||||
EXPECT_NE(0, t.run({"-i", "/", "-o", "-", "-F", "grmpf"}));
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("could not parse filter rule"));
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, time_resolution_zero) {
|
||||
mkdwarfs_tester t;
|
||||
EXPECT_NE(0, t.run({"-i", "/", "-o", "-", "--time-resolution=0"}));
|
||||
EXPECT_THAT(t.err(),
|
||||
::testing::HasSubstr("'--time-resolution' must be nonzero"));
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, time_resolution_invalid) {
|
||||
mkdwarfs_tester t;
|
||||
EXPECT_NE(0, t.run({"-i", "/", "-o", "-", "--time-resolution=grmpf"}));
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("'--time-resolution' is invalid"));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr std::array<std::string_view, 6> const debug_filter_mode_names = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user