aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-05-16 11:19:59 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-22 08:05:58 -0500
commit24f9309d6ecd559d24c54391fadef76cdbde1097 (patch)
treef8238a7806bb76739bc74df4aa697a6c3c231eaa /src/tests
parent7f014add61da3e0411d742756ce372fc0e2aee30 (diff)
serial-parsers,port-serial-at: move echo removal into serial parser
Mainly because we need somewhere to stash the call end regex, and it's silly to have a 3rd instance of that in MMPortSerialAt when we already have one in the serial parsers that MMPortSerialAt relies on pretty heavily. Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test-at-serial-port.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tests/test-at-serial-port.c b/src/tests/test-at-serial-port.c
index 5372c478..5592971d 100644
--- a/src/tests/test-at-serial-port.c
+++ b/src/tests/test-at-serial-port.c
@@ -89,6 +89,7 @@ at_serial_echo_removal (void)
guint i;
for (i = 0; i < G_N_ELEMENTS (echo_removal_tests); i++) {
+ gpointer parser;
GByteArray *ba;
/* Note that we add last NUL also to the byte array, so that we can compare
@@ -98,7 +99,9 @@ at_serial_echo_removal (void)
(guint8 *)echo_removal_tests[i].original,
strlen (echo_removal_tests[i].original) + 1);
- mm_port_serial_at_remove_echo (ba);
+ parser = mm_serial_parser_v1_new ();
+ mm_serial_parser_v1_remove_echo (parser, ba);
+ mm_serial_parser_v1_destroy (parser);
g_assert_cmpstr ((gchar *)ba->data, ==, echo_removal_tests[i].without_echo);
@@ -119,6 +122,7 @@ _run_parse_test (const ParseResponseTest tests[], guint number_of_tests)
parser = mm_serial_parser_v1_new ();
response = g_string_new (tests[i].response);
found = mm_serial_parser_v1_parse (parser, response, NULL, &error);
+ mm_serial_parser_v1_destroy (parser);
/* Verify if we expect a match or not */
g_assert_cmpint (found, ==, tests[i].found);