File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1010#ifndef XEUS_CPP_PARSER_HPP
1111#define XEUS_CPP_PARSER_HPP
1212
13+ #include " xeus-cpp/xeus_cpp_config.hpp"
14+
1315#include < string>
1416
1517namespace xcpp
16- {
18+ {
19+ XEUS_CPP_API
1720 std::string trim (const std::string& str);
1821}
1922#endif
Original file line number Diff line number Diff line change 1212#include " xeus-cpp/xmanager.hpp"
1313#include " xeus-cpp/xutils.hpp"
1414
15+ #include " ../src/xparser.hpp"
16+
1517TEST_SUITE (" execute_request" )
1618{
1719 TEST_CASE (" fetch_documentation" )
@@ -50,6 +52,37 @@ TEST_SUITE("extract_filename")
5052 }
5153}
5254
55+ TEST_SUITE (" trim" ){
56+
57+ TEST_CASE (" trim_basic_test" ){
58+ std::string argument = " argument" ;
59+
60+ std::string result = xcpp::trim (argument);
61+
62+ REQUIRE (result == " argument" );
63+ }
64+
65+ /* Checks if it trims the string which
66+ has an empty space at the start and in the end*/
67+ TEST_CASE (" trim_start_and_end" ){
68+ std::string argument = " argument " ;
69+
70+ std::string result = xcpp::trim (argument);
71+
72+ REQUIRE (result == " argument" );
73+ }
74+
75+ /* Checks if it trims the string which has no characters*/
76+ TEST_CASE (" trim_empty" ){
77+ std::string argument = " " ;
78+
79+ std::string result = xcpp::trim (argument);
80+
81+ REQUIRE (result == " " );
82+ }
83+
84+ }
85+
5386TEST_SUITE (" should_print_version" )
5487{
5588 // This test case checks if the function `should_print_version` correctly identifies
You can’t perform that action at this time.
0 commit comments