removed \e from sourcecode and testcases

This commit is contained in:
prozessorkern 2020-02-03 20:45:19 +01:00
parent ea3c90f305
commit 34ec2d9b45
9 changed files with 16 additions and 16 deletions

View File

@ -43,8 +43,8 @@ UNITTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(UNITTEST_SOURCES))
INTEGRATIONTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(INTEGRATIONTEST_SOURCES)) INTEGRATIONTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(INTEGRATIONTEST_SOURCES))
CFLAGS := $(INCLUDES:%=-I%) -g -Wall -Werror CFLAGS := $(INCLUDES:%=-I%) -g -Wall -Werror -pedantic
TESTFLAGS := $(INCLUDES:%=-I%) -g -Wall -Werror -fprofile-arcs -ftest-coverage TESTFLAGS := $(INCLUDES:%=-I%) -g -Wall -Werror -fprofile-arcs -ftest-coverage -pedantic
TESTLFLAGS := -fprofile-arcs -Wl,--allow-multiple-definition TESTLFLAGS := -fprofile-arcs -Wl,--allow-multiple-definition
DEPEND = -MT $@ -MF "$(@:%.o=%.d)" -MG -MM DEPEND = -MT $@ -MF "$(@:%.o=%.d)" -MG -MM

View File

@ -403,7 +403,7 @@ shellmatta_retCode_t shellmatta_processData(shellmatta_handle_t handle,
utils_removeChars(inst, 1u, false); utils_removeChars(inst, 1u, false);
} }
/** -# check for start of escape sequence */ /** -# check for start of escape sequence */
else if('\e' == *data) else if('\x1b' == *data)
{ {
inst->escapeCounter = 1u; inst->escapeCounter = 1u;
} }

View File

@ -91,7 +91,7 @@ uint32_t utils_shellItoa(int32_t value, char *buffer, uint32_t base)
*/ */
void utils_saveCursorPos(shellmatta_instance_t *inst) void utils_saveCursorPos(shellmatta_instance_t *inst)
{ {
utils_writeEcho(inst, "\e[s", 3u); utils_writeEcho(inst, "\x1b[s", 3u);
} }
/** /**
@ -100,7 +100,7 @@ void utils_saveCursorPos(shellmatta_instance_t *inst)
*/ */
void utils_restoreCursorPos(shellmatta_instance_t *inst) void utils_restoreCursorPos(shellmatta_instance_t *inst)
{ {
utils_writeEcho(inst, "\e[u", 3u); utils_writeEcho(inst, "\x1b[u", 3u);
} }
/** /**
@ -110,7 +110,7 @@ void utils_restoreCursorPos(shellmatta_instance_t *inst)
*/ */
void utils_eraseLine(shellmatta_instance_t *inst) void utils_eraseLine(shellmatta_instance_t *inst)
{ {
utils_writeEcho(inst, "\e[K", 3u); utils_writeEcho(inst, "\x1b[K", 3u);
} }
/** /**
@ -126,7 +126,7 @@ void utils_rewindCursor(shellmatta_instance_t *inst, uint32_t length)
length = SHELLMATTA_MIN (length, inst->cursor); length = SHELLMATTA_MIN (length, inst->cursor);
if(length > 0u) if(length > 0u)
{ {
terminalCmd[0] = '\e'; terminalCmd[0] = '\x1b';
terminalCmd[1] = '['; terminalCmd[1] = '[';
size = 2u + utils_shellItoa(length, &terminalCmd[2], 10); size = 2u + utils_shellItoa(length, &terminalCmd[2], 10);
terminalCmd[size] = 'D'; terminalCmd[size] = 'D';
@ -148,7 +148,7 @@ void utils_forwardCursor(shellmatta_instance_t *inst, uint32_t length)
length = SHELLMATTA_MIN (length, (inst->inputCount - inst->cursor)); length = SHELLMATTA_MIN (length, (inst->inputCount - inst->cursor));
if (length > 0u) if (length > 0u)
{ {
terminalCmd[0] = '\e'; terminalCmd[0] = '\x1b';
terminalCmd[1] = '['; terminalCmd[1] = '[';
size = 2u + utils_shellItoa(length, &terminalCmd[2], 10); size = 2u + utils_shellItoa(length, &terminalCmd[2], 10);
terminalCmd[size] = 'C'; terminalCmd[size] = 'C';

View File

@ -36,5 +36,5 @@ TEST_CASE( "shellmatta_utils_eraseLine" ) {
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 3u); CHECK( write_length == 3u);
REQUIRE( strncmp("\e[K", write_data, 3u) == 0); REQUIRE( strncmp("\x1b[K", write_data, 3u) == 0);
} }

View File

@ -36,7 +36,7 @@ TEST_CASE( "shellmatta_utils_forwardCursor normal" ) {
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 4u); CHECK( write_length == 4u);
REQUIRE( strncmp("\e[5C", write_data, 4u) == 0); REQUIRE( strncmp("\x1b[5C", write_data, 4u) == 0);
} }
TEST_CASE( "shellmatta_utils_forwardCursor normal echo off" ) { TEST_CASE( "shellmatta_utils_forwardCursor normal echo off" ) {
@ -85,7 +85,7 @@ TEST_CASE( "shellmatta_utils_forwardCursor forward by 12 with cursor at 5 and in
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 4u); CHECK( write_length == 4u);
REQUIRE( strncmp("\e[5C", write_data, 4u) == 0); REQUIRE( strncmp("\x1b[5C", write_data, 4u) == 0);
} }
TEST_CASE( "shellmatta_utils_forwardCursor forward by 0" ) { TEST_CASE( "shellmatta_utils_forwardCursor forward by 0" ) {

View File

@ -36,7 +36,7 @@ TEST_CASE( "shellmatta_insertChars normal call" ) {
CHECK( inst.cursor == 12); CHECK( inst.cursor == 12);
CHECK( inst.inputCount == 14); CHECK( inst.inputCount == 14);
CHECK( write_callCnt == 5u ); CHECK( write_callCnt == 5u );
CHECK( strncmp("blks\e[K\e[sij\e[u", write_data, 15u) == 0); CHECK( strncmp("blks\x1b[K\x1b[sij\x1b[u", write_data, 15u) == 0);
REQUIRE( strncmp("abcdefghblksij\0\0\0\0\0\0\0", buffer, sizeof(buffer)) == 0); REQUIRE( strncmp("abcdefghblksij\0\0\0\0\0\0\0", buffer, sizeof(buffer)) == 0);
} }

View File

@ -36,5 +36,5 @@ TEST_CASE( "shellmatta_utils_restoreCursorPos" ) {
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 3u); CHECK( write_length == 3u);
REQUIRE( strncmp("\e[u", write_data, 3u) == 0); REQUIRE( strncmp("\x1b[u", write_data, 3u) == 0);
} }

View File

@ -36,7 +36,7 @@ TEST_CASE( "shellmatta_utils_rewindCursor normal" ) {
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 4u); CHECK( write_length == 4u);
REQUIRE( strncmp("\e[5D", write_data, 4u) == 0); REQUIRE( strncmp("\x1b[5D", write_data, 4u) == 0);
} }
@ -61,7 +61,7 @@ TEST_CASE( "shellmatta_utils_rewindCursor rewind by 12 with cursor at 10" ) {
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 5u); CHECK( write_length == 5u);
REQUIRE( strncmp("\e[10D", write_data, 5u) == 0); REQUIRE( strncmp("\x1b[10D", write_data, 5u) == 0);
} }
TEST_CASE( "shellmatta_utils_rewindCursor rewind by 0" ) { TEST_CASE( "shellmatta_utils_rewindCursor rewind by 0" ) {

View File

@ -36,5 +36,5 @@ TEST_CASE( "shellmatta_utils_saveCursorPos" ) {
CHECK( write_callCnt == 1u); CHECK( write_callCnt == 1u);
CHECK( write_length == 3u); CHECK( write_length == 3u);
REQUIRE( strncmp("\e[s", write_data, 3u) == 0); REQUIRE( strncmp("\x1b[s", write_data, 3u) == 0);
} }