diff --git a/include/xeus/xhelper.hpp b/include/xeus/xhelper.hpp index 6ff3b692..c06354a6 100644 --- a/include/xeus/xhelper.hpp +++ b/include/xeus/xhelper.hpp @@ -24,7 +24,7 @@ namespace xeus { XEUS_API std::string get_start_message(const xconfiguration& config); - XEUS_API std::string extract_filename(int argc, char* argv[]); + XEUS_API std::string extract_filename(int &argc, char* argv[]); XEUS_API bool should_print_version(int argc, char* argv[]); diff --git a/src/xhelper.cpp b/src/xhelper.cpp index 98d999f3..783cc6a4 100644 --- a/src/xhelper.cpp +++ b/src/xhelper.cpp @@ -30,7 +30,7 @@ namespace xeus return kernel_info; } - std::string extract_filename(int argc, char* argv[]) + std::string extract_filename(int &argc, char* argv[]) { std::string res = ""; for (int i = 0; i < argc; ++i) diff --git a/test/test_unit_kernel.cpp b/test/test_unit_kernel.cpp index 97a967ee..1acb78c5 100644 --- a/test/test_unit_kernel.cpp +++ b/test/test_unit_kernel.cpp @@ -55,11 +55,13 @@ namespace xeus TEST_CASE("extract_filename") { + int argc = 3; char* argv[2]; argv[0] = (char*)"-f"; argv[1] = (char*)"connection.json"; - std::string file_name = extract_filename(3, argv); + std::string file_name = extract_filename(argc, argv); REQUIRE_EQ(file_name, "connection.json"); + REQUIRE_EQ(argc, 1); } TEST_CASE("should_print_version")