Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extract_filename function #408

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: SimenB/github-actions-cpu-cores@v2

- name: Install mamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-dev.yml
environment-name: xeus
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install mamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-dev.yml
environment-name: xeus
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
uses: SimenB/github-actions-cpu-cores@v2

- name: Install mamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment-wasm-build.yml
environment-name: xeus-wasm-build
Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xhelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[]);

Expand Down
2 changes: 1 addition & 1 deletion src/xhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion test/test_unit_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down