diff --git a/lua/cmake-tools/init.lua b/lua/cmake-tools/init.lua index a6d1fc04..d9f41d96 100644 --- a/lua/cmake-tools/init.lua +++ b/lua/cmake-tools/init.lua @@ -1183,7 +1183,7 @@ function cmake.run_test(opt, callback) return end if idx == 1 then - ctest.run(const.ctest_command, "'.*'", config:build_directory_path(), env, config, opt) + ctest.run(const.ctest_command, nil, config:build_directory_path(), env, config, opt) else ctest.run( const.ctest_command, diff --git a/lua/cmake-tools/test/ctest.lua b/lua/cmake-tools/test/ctest.lua index e3575ee5..a5fdf8a2 100644 --- a/lua/cmake-tools/test/ctest.lua +++ b/lua/cmake-tools/test/ctest.lua @@ -38,7 +38,14 @@ function ctest.run(ctest_command, test_name, build_dir, env, config, opt) local cmd = ctest_command opt = opt or {} - local args = { "--test-dir", utils.transform_path(build_dir), "-R", test_name, opt.args } + local args = { "--test-dir", utils.transform_path(build_dir) } + if test_name then + table.insert(args, "-R") + table.insert(args, test_name) + end + if opt.args then + table.insert(args, opt.args) + end utils.run(cmd, config.env_script, env, args, config.cwd, config.runner, nil) end