|
@@ -459,7 +459,7 @@ TEST_CASE( "shellmatta configure disable echo" ) {
|
|
write_length = 0u;
|
|
write_length = 0u;
|
|
|
|
|
|
/* turn off echo now */
|
|
/* turn off echo now */
|
|
- ret = shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false);
|
|
|
|
|
|
+ ret = shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
CHECK( ret == SHELLMATTA_OK );
|
|
CHECK( ret == SHELLMATTA_OK );
|
|
|
|
|
|
/* check with echo disabled */
|
|
/* check with echo disabled */
|
|
@@ -490,7 +490,7 @@ TEST_CASE( "shellmatta configure mode" ) {
|
|
NULL,
|
|
NULL,
|
|
writeFct);
|
|
writeFct);
|
|
shellmatta_addCmd(handle, &doSomethingCmd);
|
|
shellmatta_addCmd(handle, &doSomethingCmd);
|
|
- ret = shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false);
|
|
|
|
|
|
+ ret = shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
|
|
|
|
write_callCnt = 0u;
|
|
write_callCnt = 0u;
|
|
memset(write_data, 0, sizeof(write_data));
|
|
memset(write_data, 0, sizeof(write_data));
|
|
@@ -507,7 +507,7 @@ TEST_CASE( "shellmatta configure mode" ) {
|
|
write_length = 0u;
|
|
write_length = 0u;
|
|
|
|
|
|
/* check with overwrite mode */
|
|
/* check with overwrite mode */
|
|
- ret = shellmatta_configure(handle, SHELLMATTA_MODE_OVERWRITE, false);
|
|
|
|
|
|
+ ret = shellmatta_configure(handle, SHELLMATTA_MODE_OVERWRITE, false, '\r');
|
|
CHECK( ret == SHELLMATTA_OK );
|
|
CHECK( ret == SHELLMATTA_OK );
|
|
|
|
|
|
/* check with echo disabled */
|
|
/* check with echo disabled */
|
|
@@ -517,3 +517,49 @@ TEST_CASE( "shellmatta configure mode" ) {
|
|
REQUIRE( strcmp(dummyData2, write_data) == 0);
|
|
REQUIRE( strcmp(dummyData2, write_data) == 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+TEST_CASE( "shellmatta configure delimiter" ) {
|
|
|
|
+
|
|
|
|
+ shellmatta_instance_t inst;
|
|
|
|
+ shellmatta_handle_t handle;
|
|
|
|
+ shellmatta_retCode_t ret;
|
|
|
|
+ char buffer[1024];
|
|
|
|
+ char historyBuffer[1024];
|
|
|
|
+ char *dummyData = (char*)"doSomething argument - length: 20\r\nshellmatta->";
|
|
|
|
+
|
|
|
|
+ shellmatta_doInit( &inst,
|
|
|
|
+ &handle,
|
|
|
|
+ buffer,
|
|
|
|
+ sizeof(buffer),
|
|
|
|
+ historyBuffer,
|
|
|
|
+ sizeof(historyBuffer),
|
|
|
|
+ "shellmatta->",
|
|
|
|
+ NULL,
|
|
|
|
+ writeFct);
|
|
|
|
+ shellmatta_addCmd(handle, &doSomethingCmd);
|
|
|
|
+ ret = shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
|
|
+
|
|
|
|
+ write_callCnt = 0u;
|
|
|
|
+ memset(write_data, 0, sizeof(write_data));
|
|
|
|
+ write_length = 0u;
|
|
|
|
+
|
|
|
|
+ /* check with insert mode */
|
|
|
|
+ shellmatta_processData(handle, (char*)"doSomething argument\n", 21u);
|
|
|
|
+
|
|
|
|
+ CHECK( write_length == 0u);
|
|
|
|
+
|
|
|
|
+ shellmatta_resetShell(handle, false);
|
|
|
|
+ write_callCnt = 0u;
|
|
|
|
+ memset(write_data, 0, sizeof(write_data));
|
|
|
|
+ write_length = 0u;
|
|
|
|
+
|
|
|
|
+ /* check with changed delimiter mode */
|
|
|
|
+ ret = shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\n');
|
|
|
|
+ CHECK( ret == SHELLMATTA_OK );
|
|
|
|
+
|
|
|
|
+ /* check with echo disabled */
|
|
|
|
+ shellmatta_processData(handle, (char*)"doSomething argument\n", 21u);
|
|
|
|
+
|
|
|
|
+ CHECK( write_length == strlen(dummyData));
|
|
|
|
+ REQUIRE( strcmp(dummyData, write_data) == 0);
|
|
|
|
+}
|
|
|
|
+
|