Skip to content

Commit d55c47d

Browse files
committed
trial 2
1 parent 7a440b8 commit d55c47d

File tree

1 file changed

+41
-33
lines changed

1 file changed

+41
-33
lines changed

test/test_interpreter.cpp

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,39 +68,43 @@ class StreamRedirectRAII {
6868

6969
TEST_SUITE("execute_request")
7070
{
71-
// TEST_CASE("stl")
72-
// {
73-
// std::vector<const char*> Args = {
74-
// "-v",
75-
// "-Xclang", "-iwithsysroot/include/compat"
76-
// };
77-
// xcpp::interpreter interpreter((int)Args.size(), Args.data());
78-
// std::string code = "#include <vector>";
79-
// nl::json user_expressions = nl::json::object();
80-
// xeus::execute_request_config config;
81-
// config.silent = false;
82-
// config.store_history = false;
83-
// config.allow_stdin = false;
84-
// nl::json header = nl::json::object();
85-
// xeus::xrequest_context::guid_list id = {};
86-
// xeus::xrequest_context context(header, id);
87-
88-
// std::promise<nl::json> promise;
89-
// std::future<nl::json> future = promise.get_future();
90-
// auto callback = [&promise](nl::json result) {
91-
// promise.set_value(result);
92-
// };
93-
94-
// interpreter.execute_request(
95-
// std::move(context),
96-
// std::move(callback),
97-
// code,
98-
// std::move(config),
99-
// user_expressions
100-
// );
101-
// nl::json result = future.get();
102-
// REQUIRE(result["status"] == "ok");
103-
// }
71+
TEST_CASE("stl")
72+
{
73+
#if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
74+
std::vector<const char*> Args = {
75+
"-v",
76+
"-Xclang", "-iwithsysroot/include/compat"
77+
};
78+
#else
79+
std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
80+
#endif
81+
xcpp::interpreter interpreter((int)Args.size(), Args.data());
82+
std::string code = "#include <vector>";
83+
nl::json user_expressions = nl::json::object();
84+
xeus::execute_request_config config;
85+
config.silent = false;
86+
config.store_history = false;
87+
config.allow_stdin = false;
88+
nl::json header = nl::json::object();
89+
xeus::xrequest_context::guid_list id = {};
90+
xeus::xrequest_context context(header, id);
91+
92+
std::promise<nl::json> promise;
93+
std::future<nl::json> future = promise.get_future();
94+
auto callback = [&promise](nl::json result) {
95+
promise.set_value(result);
96+
};
97+
98+
interpreter.execute_request(
99+
std::move(context),
100+
std::move(callback),
101+
code,
102+
std::move(config),
103+
user_expressions
104+
);
105+
nl::json result = future.get();
106+
REQUIRE(result["status"] == "ok");
107+
}
104108

105109
TEST_CASE("headers found in sysroot/include/compat")
106110
{
@@ -850,10 +854,14 @@ TEST_SUITE("complete_request")
850854
{
851855
TEST_CASE("completion_test")
852856
{
857+
#if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
853858
std::vector<const char*> Args = {
854859
"-v",
855860
"-Xclang", "-iwithsysroot/include/compat"
856861
};
862+
#else
863+
std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
864+
#endif
857865
xcpp::interpreter interpreter((int)Args.size(), Args.data());
858866
std::string code1 = "#include <iostream>";
859867
nl::json user_expressions = nl::json::object();

0 commit comments

Comments
 (0)