bugfix - now stdin returns 0 if the heredoc body is empty
This commit is contained in:
@@ -175,6 +175,38 @@ TEST_CASE( "shellmatta heredoc test" ) {
|
||||
REQUIRE( strcmp(dummyData, doSomethingArguments) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE( "shellmatta heredoc test empty" ) {
|
||||
|
||||
shellmatta_instance_t inst;
|
||||
shellmatta_handle_t handle;
|
||||
char buffer[1024];
|
||||
char historyBuffer[1024];
|
||||
char *dummyData = (char*)"do this ";
|
||||
|
||||
shellmatta_doInit( &inst,
|
||||
&handle,
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
historyBuffer,
|
||||
sizeof(historyBuffer),
|
||||
"shellmatta->",
|
||||
NULL,
|
||||
writeFct);
|
||||
shellmatta_addCmd(handle, &doSomethingCmd);
|
||||
|
||||
doSomethingArguments = NULL;
|
||||
doSomethingLength = 0u;
|
||||
|
||||
shellmatta_processData(handle, (char*)"do this << EOF\r\n"
|
||||
"EOF\r\n"
|
||||
, 21);
|
||||
|
||||
CHECK( doSomethingStdinLength == 0u);
|
||||
CHECK( NULL == doSomethingStdin );
|
||||
CHECK( doSomethingLength == 8u);
|
||||
REQUIRE( strcmp(dummyData, doSomethingArguments) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE( "shellmatta remove function" ) {
|
||||
|
||||
shellmatta_instance_t inst;
|
||||
|
Reference in New Issue
Block a user