Skip to content

Removed build_interpreter from main() #292

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

Merged
merged 3 commits into from
May 1, 2025
Merged
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
3 changes: 0 additions & 3 deletions include/xeus-cpp/xutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ namespace xcpp
XEUS_CPP_API
void stop_handler(int sig);

XEUS_CPP_API
interpreter_ptr build_interpreter(int argc, char** argv);

XEUS_CPP_API
std::string retrieve_tagconf_dir();

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int main(int argc, char* argv[])
signal(SIGINT, xcpp::stop_handler);

std::string file_name = xeus::extract_filename(argc, argv);
interpreter_ptr interpreter = xcpp::build_interpreter(argc, argv);
auto interpreter = std::make_unique<xcpp::interpreter>(argc, argv);
std::unique_ptr<xeus::xcontext> context = xeus::make_zmq_context();

if (!file_name.empty())
Expand Down
15 changes: 0 additions & 15 deletions src/xutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ namespace xcpp
exit(0);
}

interpreter_ptr build_interpreter(int argc, char** argv)
{
std::vector<const char*> interpreter_argv(argc);
interpreter_argv[0] = "xeus-cpp";

// Copy all arguments in the new vector excepting the process name.
for (int i = 1; i < argc; i++)
{
interpreter_argv[i] = argv[i];
}

interpreter_ptr interp_ptr = std::make_unique<interpreter>(argc, interpreter_argv.data());
return interp_ptr;
}

std::string retrieve_tagconf_dir()
{
const char* tagconf_dir_env = std::getenv("XCPP_TAGCONFS_DIR");
Expand Down
18 changes: 0 additions & 18 deletions test/test_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,24 +344,6 @@ TEST_SUITE("trim"){

}

TEST_SUITE("build_interpreter")
{
// This test case checks if the function `build_interpreter` returns a non-null pointer
// when valid arguments are passed. It sets up a scenario with valid command line arguments
// and checks if the function returns a non-null pointer.
TEST_CASE("build_interpreter_pointer_not_null")
{
char arg1[] = "program_name";
char arg2[] = "-option1";
char* argv[] = {arg1, arg2};
int argc = 2;

interpreter_ptr interp_ptr = xcpp::build_interpreter(argc, argv);

REQUIRE(interp_ptr != nullptr);
}
}

TEST_SUITE("is_match_magics_manager")
{
// This test case checks if the function `is_match` correctly identifies strings that match
Expand Down
Loading