@@ -56,6 +56,46 @@ TEST_SUITE("execute_request")
56
56
}
57
57
}
58
58
59
+ TEST_SUITE (" inspect_request" )
60
+ {
61
+ TEST_CASE (" good_status" )
62
+ {
63
+ std::vector<const char *> Args = {/* "-v", "resource-dir", "....."*/ };
64
+ xcpp::interpreter interpreter ((int )Args.size (), Args.data ());
65
+
66
+ std::string code = " std::vector" ;
67
+ int cursor_pos = 11 ;
68
+
69
+ nl::json result = interpreter.inspect_request (
70
+ code,
71
+ cursor_pos,
72
+ /* detail_level=*/ 0
73
+ );
74
+
75
+ REQUIRE (result[" user_expressions" ] == nl::json::object ());
76
+ REQUIRE (result[" found" ] == true );
77
+ REQUIRE (result[" status" ] == " ok" );
78
+ }
79
+
80
+ TEST_CASE (" bad_status" )
81
+ {
82
+ std::vector<const char *> Args = {/* "-v", "resource-dir", "....."*/ };
83
+ xcpp::interpreter interpreter ((int )Args.size (), Args.data ());
84
+
85
+ std::string code = " nonExistentFunction" ;
86
+ int cursor_pos = 19 ;
87
+
88
+ nl::json result = interpreter.inspect_request (
89
+ code,
90
+ cursor_pos,
91
+ /* detail_level=*/ 0
92
+ );
93
+
94
+ REQUIRE (result[" found" ] == false );
95
+ REQUIRE (result[" status" ] == " error" );
96
+ }
97
+ }
98
+
59
99
TEST_SUITE (" extract_filename" )
60
100
{
61
101
TEST_CASE (" extract_filename_basic_test" )
@@ -98,6 +138,15 @@ TEST_SUITE("trim"){
98
138
REQUIRE (result == " " );
99
139
}
100
140
141
+ /* Checks if it trims the string is empty*/
142
+ TEST_CASE (" trim_empty" ){
143
+ std::string argument = " " ;
144
+
145
+ std::string result = xcpp::trim (argument);
146
+
147
+ REQUIRE (result == " " );
148
+ }
149
+
101
150
}
102
151
103
152
TEST_SUITE (" should_print_version" )
0 commit comments