@@ -134,6 +134,43 @@ TEST_SUITE("execute_request")
134134 REQUIRE (result[" status" ] == " ok" );
135135 }
136136
137+ TEST_CASE (" fetch_documentation_of_member_or_parameter" )
138+ {
139+ std::vector<const char *> Args = {/* "-v", "resource-dir", "....."*/ };
140+ xcpp::interpreter interpreter ((int )Args.size (), Args.data ());
141+
142+ std::string code = " ?std::vector.push_back" ;
143+ std::string inspect_result = " https://en.cppreference.com/w/cpp/container/vector/push_back" ;
144+ nl::json user_expressions = nl::json::object ();
145+ xeus::execute_request_config config;
146+ config.silent = false ;
147+ config.store_history = false ;
148+ config.allow_stdin = false ;
149+ nl::json header = nl::json::object ();
150+ xeus::xrequest_context::guid_list id = {};
151+ xeus::xrequest_context context (header, id);
152+
153+ std::promise<nl::json> promise;
154+ std::future<nl::json> future = promise.get_future ();
155+ auto callback = [&promise](nl::json result) {
156+ promise.set_value (result);
157+ };
158+
159+ interpreter.execute_request (
160+ std::move (context),
161+ std::move (callback),
162+ code,
163+ std::move (config),
164+ user_expressions
165+ );
166+ nl::json result = future.get ();
167+ REQUIRE (result[" payload" ][0 ][" data" ][" text/plain" ] == inspect_result);
168+ REQUIRE (result[" user_expressions" ] == nl::json::object ());
169+ REQUIRE (result[" found" ] == true );
170+ REQUIRE (result[" status" ] == " ok" );
171+ }
172+
173+
137174 TEST_CASE (" bad_status" )
138175 {
139176 std::vector<const char *> Args = {" resource-dir" };
@@ -840,6 +877,27 @@ TEST_SUITE("xinspect"){
840877 cmp.child_value = " nonexistentMethod" ;
841878 REQUIRE (cmp (node) == false );
842879 }
880+
881+ TEST_CASE (" find_type_slow" ){
882+ std::string expression = " int" ;
883+ std::string result = xcpp::find_type_slow (expression);
884+ std::cout << result << std::endl;
885+ bool res = (result == " <unnamed>" || result == " " );
886+ REQUIRE (res);
887+
888+ expression = " std::vector<int>" ;
889+ result = xcpp::find_type_slow (expression);
890+ std::cout << result << std::endl;
891+ REQUIRE (result == " <unnamed>" );
892+ }
893+
894+ TEST_CASE (" is_inspect_request" ){
895+ std::string code = " vector" ;
896+ std::regex re_expression (R"( non_matching_pattern)" );
897+ std::pair<bool , std::smatch> result = xcpp::is_inspect_request (code, re_expression);
898+ REQUIRE (result.first == false );
899+ }
900+
843901}
844902
845903TEST_SUITE (" xassist" ){
0 commit comments