Skip to content

Commit 305feb5

Browse files
committed
trial 4
1 parent 56bc148 commit 305feb5

File tree

1 file changed

+171
-171
lines changed

1 file changed

+171
-171
lines changed

test/test_interpreter.cpp

Lines changed: 171 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -68,121 +68,121 @@ class StreamRedirectRAII {
6868

6969
TEST_SUITE("execute_request")
7070
{
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-
}
108-
109-
TEST_CASE("headers found in sysroot/include/compat")
110-
{
111-
#if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
112-
std::vector<const char*> Args = {
113-
"-v",
114-
"-Xclang", "-iwithsysroot/include/compat"
115-
};
116-
#else
117-
std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
118-
#endif
119-
120-
xcpp::interpreter interpreter((int)Args.size(), Args.data());
121-
std::string code = "#include <xlocale.h>";
122-
nl::json user_expressions = nl::json::object();
123-
xeus::execute_request_config config;
124-
config.silent = false;
125-
config.store_history = false;
126-
config.allow_stdin = false;
127-
nl::json header = nl::json::object();
128-
xeus::xrequest_context::guid_list id = {};
129-
xeus::xrequest_context context(header, id);
130-
131-
std::promise<nl::json> promise;
132-
std::future<nl::json> future = promise.get_future();
133-
auto callback = [&promise](nl::json result) {
134-
promise.set_value(result);
135-
};
136-
137-
interpreter.execute_request(
138-
std::move(context),
139-
std::move(callback),
140-
code,
141-
std::move(config),
142-
user_expressions
143-
);
144-
nl::json result = future.get();
145-
REQUIRE(result["status"] == "ok");
146-
}
147-
148-
#if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
149-
TEST_CASE("Emscripten Exception Handling")
150-
{
151-
std::vector<const char*> Args = {
152-
"-std=c++20",
153-
"-v",
154-
"-fwasm-exceptions",
155-
"-mllvm", "-wasm-enable-sjlj"
156-
};
157-
158-
xcpp::interpreter interpreter((int)Args.size(), Args.data());
159-
std::string code = "try { throw 1; } catch (...) { 0; }";
160-
nl::json user_expressions = nl::json::object();
161-
xeus::execute_request_config config;
162-
config.silent = false;
163-
config.store_history = false;
164-
config.allow_stdin = false;
165-
nl::json header = nl::json::object();
166-
xeus::xrequest_context::guid_list id = {};
167-
xeus::xrequest_context context(header, id);
168-
169-
std::promise<nl::json> promise;
170-
std::future<nl::json> future = promise.get_future();
171-
auto callback = [&promise](nl::json result) {
172-
promise.set_value(result);
173-
};
174-
175-
interpreter.execute_request(
176-
std::move(context),
177-
std::move(callback),
178-
code,
179-
std::move(config),
180-
user_expressions
181-
);
182-
nl::json result = future.get();
183-
REQUIRE(result["status"] == "ok");
184-
}
185-
#endif
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+
// }
108+
109+
// TEST_CASE("headers found in sysroot/include/compat")
110+
// {
111+
// #if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
112+
// std::vector<const char*> Args = {
113+
// "-v",
114+
// "-Xclang", "-iwithsysroot/include/compat"
115+
// };
116+
// #else
117+
// std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
118+
// #endif
119+
120+
// xcpp::interpreter interpreter((int)Args.size(), Args.data());
121+
// std::string code = "#include <xlocale.h>";
122+
// nl::json user_expressions = nl::json::object();
123+
// xeus::execute_request_config config;
124+
// config.silent = false;
125+
// config.store_history = false;
126+
// config.allow_stdin = false;
127+
// nl::json header = nl::json::object();
128+
// xeus::xrequest_context::guid_list id = {};
129+
// xeus::xrequest_context context(header, id);
130+
131+
// std::promise<nl::json> promise;
132+
// std::future<nl::json> future = promise.get_future();
133+
// auto callback = [&promise](nl::json result) {
134+
// promise.set_value(result);
135+
// };
136+
137+
// interpreter.execute_request(
138+
// std::move(context),
139+
// std::move(callback),
140+
// code,
141+
// std::move(config),
142+
// user_expressions
143+
// );
144+
// nl::json result = future.get();
145+
// REQUIRE(result["status"] == "ok");
146+
// }
147+
148+
// #if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
149+
// TEST_CASE("Emscripten Exception Handling")
150+
// {
151+
// std::vector<const char*> Args = {
152+
// "-std=c++20",
153+
// "-v",
154+
// "-fwasm-exceptions",
155+
// "-mllvm", "-wasm-enable-sjlj"
156+
// };
157+
158+
// xcpp::interpreter interpreter((int)Args.size(), Args.data());
159+
// std::string code = "try { throw 1; } catch (...) { 0; }";
160+
// nl::json user_expressions = nl::json::object();
161+
// xeus::execute_request_config config;
162+
// config.silent = false;
163+
// config.store_history = false;
164+
// config.allow_stdin = false;
165+
// nl::json header = nl::json::object();
166+
// xeus::xrequest_context::guid_list id = {};
167+
// xeus::xrequest_context context(header, id);
168+
169+
// std::promise<nl::json> promise;
170+
// std::future<nl::json> future = promise.get_future();
171+
// auto callback = [&promise](nl::json result) {
172+
// promise.set_value(result);
173+
// };
174+
175+
// interpreter.execute_request(
176+
// std::move(context),
177+
// std::move(callback),
178+
// code,
179+
// std::move(config),
180+
// user_expressions
181+
// );
182+
// nl::json result = future.get();
183+
// REQUIRE(result["status"] == "ok");
184+
// }
185+
// #endif
186186

187187
TEST_CASE("fetch_documentation")
188188
{
@@ -854,62 +854,62 @@ TEST_SUITE("xutils_handler"){
854854
}
855855
#endif
856856

857-
TEST_SUITE("complete_request")
858-
{
859-
TEST_CASE("completion_test")
860-
{
861-
#if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
862-
std::vector<const char*> Args = {
863-
"-v",
864-
"-Xclang", "-iwithsysroot/include/compat"
865-
};
866-
#else
867-
std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
868-
#endif
869-
xcpp::interpreter interpreter((int)Args.size(), Args.data());
870-
std::string code1 = "#include <iostream>";
871-
nl::json user_expressions = nl::json::object();
872-
xeus::execute_request_config config;
873-
config.silent = false;
874-
config.store_history = false;
875-
config.allow_stdin = false;
876-
nl::json header = nl::json::object();
877-
xeus::xrequest_context::guid_list id = {};
878-
xeus::xrequest_context context(header, id);
879-
880-
std::promise<nl::json> promise;
881-
std::future<nl::json> future = promise.get_future();
882-
auto callback = [&promise](nl::json result) {
883-
promise.set_value(result);
884-
};
885-
886-
interpreter.execute_request(
887-
std::move(context),
888-
std::move(callback),
889-
code1,
890-
std::move(config),
891-
user_expressions
892-
);
893-
nl::json execute = future.get();
894-
895-
REQUIRE(execute["status"] == "ok");
896-
897-
std::string code2 = "st";
898-
int cursor_pos = 2;
899-
nl::json result = interpreter.complete_request(code2, cursor_pos);
900-
901-
REQUIRE(result["cursor_start"] == 0);
902-
REQUIRE(result["cursor_end"] == 2);
903-
REQUIRE(result["status"] == "ok");
904-
size_t found = 0;
905-
for (auto& r : result["matches"]) {
906-
if (r == "static" || r == "struct") {
907-
found++;
908-
}
909-
}
910-
REQUIRE(found == 2);
911-
}
912-
}
857+
// TEST_SUITE("complete_request")
858+
// {
859+
// TEST_CASE("completion_test")
860+
// {
861+
// #if defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
862+
// std::vector<const char*> Args = {
863+
// "-v",
864+
// "-Xclang", "-iwithsysroot/include/compat"
865+
// };
866+
// #else
867+
// std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
868+
// #endif
869+
// xcpp::interpreter interpreter((int)Args.size(), Args.data());
870+
// std::string code1 = "#include <iostream>";
871+
// nl::json user_expressions = nl::json::object();
872+
// xeus::execute_request_config config;
873+
// config.silent = false;
874+
// config.store_history = false;
875+
// config.allow_stdin = false;
876+
// nl::json header = nl::json::object();
877+
// xeus::xrequest_context::guid_list id = {};
878+
// xeus::xrequest_context context(header, id);
879+
880+
// std::promise<nl::json> promise;
881+
// std::future<nl::json> future = promise.get_future();
882+
// auto callback = [&promise](nl::json result) {
883+
// promise.set_value(result);
884+
// };
885+
886+
// interpreter.execute_request(
887+
// std::move(context),
888+
// std::move(callback),
889+
// code1,
890+
// std::move(config),
891+
// user_expressions
892+
// );
893+
// nl::json execute = future.get();
894+
895+
// REQUIRE(execute["status"] == "ok");
896+
897+
// std::string code2 = "st";
898+
// int cursor_pos = 2;
899+
// nl::json result = interpreter.complete_request(code2, cursor_pos);
900+
901+
// REQUIRE(result["cursor_start"] == 0);
902+
// REQUIRE(result["cursor_end"] == 2);
903+
// REQUIRE(result["status"] == "ok");
904+
// size_t found = 0;
905+
// for (auto& r : result["matches"]) {
906+
// if (r == "static" || r == "struct") {
907+
// found++;
908+
// }
909+
// }
910+
// REQUIRE(found == 2);
911+
// }
912+
// }
913913

914914
TEST_SUITE("xinspect"){
915915
TEST_CASE("class_member_predicate_get_filename"){

0 commit comments

Comments
 (0)