From 2cdf31e65d137df183393ca7e0c706238cacc7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sj=C3=B6blom?= Date: Tue, 6 Jan 2026 21:11:48 +0100 Subject: [PATCH] Will list details if properties are requested --- src/mpq.cpp | 2 ++ test/test_list.py | 32 -------------------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/mpq.cpp b/src/mpq.cpp index 4841fbe..fccb827 100644 --- a/src/mpq.cpp +++ b/src/mpq.cpp @@ -287,6 +287,8 @@ int ListFiles(HANDLE hArchive, const std::string& listfileName, bool listAll, bo // Default properties, if the user didn't specify any "file-size", "locale", "file-time", }; + } else { + listDetailed = true; // If the user specified properties, we need to print the detailed output } // "Special" files are base files used by MPQ file format diff --git a/test/test_list.py b/test/test_list.py index 6483e19..e3471da 100644 --- a/test/test_list.py +++ b/test/test_list.py @@ -109,38 +109,6 @@ def test_list_mpq_with_specified_details(binary_path): assert output_lines == expected_output, f"Unexpected output: {output_lines}" -def test_list_mpq_with_specified_details_but_no_detailed_flag(binary_path): - """ - Test MPQ file listing. - - This test checks: - - That providing parameters to be listed does nothing if the -d/--detailed flag is not provided. - """ - script_dir = Path(__file__).parent - test_file = script_dir / "data" / "mpq_with_output_v1.mpq" - - expected_output = { - "cats.txt", - "dogs.txt", - "bytes", - "(listfile)", - "(attributes)", - } - - result = subprocess.run( - [str(binary_path), "list", "-a", str(test_file), - "-p", "hash-index", "-p", "flags", "-p", "encryption-key-raw", "-p", "encryption-key"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - text=True - ) - - output_lines = set(result.stdout.splitlines()) - - assert result.returncode == 0, f"mpqcli failed with error: {result.stderr}" - assert output_lines == expected_output, f"Unexpected output: {output_lines}" - - def test_list_mpq_with_weak_signature(binary_path): """ Test MPQ file listing of MPQ with weak signature.