catch_discover_tests passes all EXTRA_ARGS as one argument
Maintainer thường phản hồi trong vòng 2 ngày
@CyberKun đang làm issue này rồi.
Từ ngày 16/11/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Bắt đầu từ tích hợp Catch với CMake được đưa vào từ extras/Catch.cmake và lần theo cách catch_discover_tests truyền EXTRA_ARGS vào các lệnh kiểm thử được tạo. Bản tái hiện cho thấy các đối số được nối bằng dấu chấm phẩy và đến chương trình nhị phân dưới dạng một token. Giữ mỗi giá trị thành một đối số riêng, sau đó xác minh bản tái hiện CMake được cung cấp chạy thành công với ctest.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
A clear and concise description of what the bug is.
catch_discover_tests joins all EXTRA_ARGS values into one argument, separated by ;. A test registered with EXTRA_ARGS --colour-mode ansi fails:
Error(s) in input:
Unrecognised token: --colour-mode;ansi
Expected behavior
A clear and concise description of what you expected to happen.
Each EXTRA_ARGS value reaches the test binary as its own argument.
Reproduction steps
Steps to reproduce the bug.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.20)
project(catch2-extra-args CXX)
set(CATCH2_TAG v3.16.1 CACHE STRING "Catch2 git tag to test")
include(FetchContent)
FetchContent_Declare(Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG ${CATCH2_TAG}
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
include(CTest)
include(Catch)
add_executable(colour_test colour_test.cpp)
target_link_libraries(colour_test PRIVATE Catch2::Catch2WithMain)
catch_discover_tests(colour_test EXTRA_ARGS --colour-mode ansi)
colour_test.cpp:
#include <catch2/catch_test_macros.hpp>
TEST_CASE("extra arguments reach the test binary") { REQUIRE(true); }
$ cmake -B build-v3.16.1 -G Ninja -DCATCH2_TAG=v3.16.1 && cmake --build build-v3.16.1 && ctest --test-dir build-v3.16.1 --output-on-failure
-- The CXX compiler identification is GNU 16.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/ii6p6kc1brz3vycqg88q4zb4xd2dmqwp-gcc-wrapper-16.2.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FLAG__ffile_prefix_map__home_reap_Desktop_nixpkgs_catch2_extra_args_build_v3_16_1__deps_catch2_src__
-- Performing Test HAVE_FLAG__ffile_prefix_map__home_reap_Desktop_nixpkgs_catch2_extra_args_build_v3_16_1__deps_catch2_src__ - Success
-- Configuring done (1.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/reap/Desktop/nixpkgs/catch2-extra-args/build-v3.16.1
[112/112] Linking CXX executable colour_test
Test project /home/reap/Desktop/nixpkgs/catch2-extra-args/build-v3.16.1
Start 1: extra arguments reach the test binary
1/1 Test #1: extra arguments reach the test binary ...***Failed 0.00 sec
Error(s) in input:
Unrecognised token: --colour-mode;ansi
Run with -? for usage
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.00 sec
The following tests FAILED:
1 - extra arguments reach the test binary (Failed)
Errors while running CTest
Platform information:
- OS: NixOS, Linux x86_64
- Compiler+version: GCC 16.2.0, CMake 4.4.4
- Catch version: v3.16.1, and devel at 36c1bc3ef209
Additional context
Add any other context about the problem here.
I found this issue while working on https://github.com/NixOS/nixpkgs/pull/587421
- Ngôn ngữ chính
- C++
- Star
- 21.6k
- Fork
- 3.4k
- Merge trung bình
- 3 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của catchorg/Catch2
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Not seeing some error messages from fakeit in jetbrains riderCó thể đã có người làm @Amanpal9 đã nhận 21 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
catchorg/Catch2#3228 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Có thể đã có người làm @nafiurahman00 đã nhận 8 ngày trước. Đang mởExtras
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
catchorg/Catch2#3241 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Commit `b710039` breaks tests with overloaded `operator==`Có thể đã có người làm @michaelbawuah đã nhận 45 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
catchorg/Catch2#3221 · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của catchorg/Catch2
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cp-algorithms/cp-algorithms#1774 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
telefonicaid/fiware-orion#4836 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nixd exits at startup when its parent process belongs to another userCó thể đã có người làm @conao3 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nix-community/nixd#930 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
refactor topic-ui topic-weather
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Command-Install Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
microsoft/winget-cli#6718 ·
Maintainer thường phản hồi trong vòng 2 ngày