catch_discover_tests passes all EXTRA_ARGS as one argument
Los mantenedores suelen responder en 2 días
@CyberKun ya está trabajando en esto.
Desde el 16/11/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 68/100
Línea de trabajo
Empieza por la integración de Catch con CMake, incluida desde extras/Catch.cmake, y sigue cómo catch_discover_tests pasa EXTRA_ARGS a los comandos de prueba generados. La reproducción muestra que los argumentos se unen con un punto y coma y llegan al binario como un único token. Mantén cada valor como un argumento independiente y, después, verifica que la reproducción de CMake proporcionada pase con ctest.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- C++
- Estrellas
- 21.6k
- Forks
- 3.4k
- Merge medio
- 3 d 12 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de catchorg/Catch2
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 2 días
-
Not seeing some error messages from fakeit in jetbrains riderPosiblemente ocupada @Amanpal9 la tomó hace 21 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
catchorg/Catch2#3228 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Posiblemente ocupada @nafiurahman00 la tomó hace 8 días. AbiertoExtras
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
catchorg/Catch2#3241 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
Commit `b710039` breaks tests with overloaded `operator==`Posiblemente ocupada @michaelbawuah la tomó hace 45 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
catchorg/Catch2#3221 · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de catchorg/Catch2
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cp-algorithms/cp-algorithms#1774 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
telefonicaid/fiware-orion#4836 ·
Los mantenedores suelen responder en 1 día
-
nixd exits at startup when its parent process belongs to another userPosiblemente ocupada @conao3 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nix-community/nixd#930 ·
Los mantenedores suelen responder en 2 días
-
refactor topic-ui topic-weather
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Command-Install Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
microsoft/winget-cli#6718 ·
Los mantenedores suelen responder en 2 días