Skip to content

Commit 71904da

Browse files
committed
trial 7
1 parent 787fe4d commit 71904da

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

test/test_interpreter.cpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -145,44 +145,44 @@ TEST_SUITE("execute_request")
145145
// REQUIRE(result["status"] == "ok");
146146
// }
147147

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-
// };
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+
};
157157

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);
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);
168168

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-
// };
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+
};
174174

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
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
{

0 commit comments

Comments
 (0)