Skip to content

Commit

Permalink
Fix extract_filename function
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed Oct 4, 2024
1 parent a8a4892 commit 7af0b73
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
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

0 comments on commit 7af0b73

Please sign in to comment.