test(cpp): tests para sql_parse, process_state_machine, file_poll_diff

This commit is contained in:
2026-04-28 23:58:40 +02:00
parent 0cfaa27ee1
commit 4f280f34d7
5 changed files with 302 additions and 6 deletions
+13 -6
View File
@@ -101,18 +101,25 @@ std::vector<SqlStatement> sql_parse(const std::string& input) {
switch (m) {
case Mode::Normal:
if (!stmt_has_content && !std::isspace(static_cast<unsigned char>(c))) {
// marca inicio "real" de un statement (despues de skip ws/comments)
stmt_line = cur_line;
stmt_has_content = true;
}
if (c == '-' && n == '-') {
m = Mode::LineComment;
++i;
if (n == '\n') ++cur_line; // (no aplica, n es '-')
} else if (c == '/' && n == '*') {
m = Mode::BlockComment;
++i;
} else if (!stmt_has_content && !std::isspace(static_cast<unsigned char>(c))) {
// marca inicio "real" de un statement (despues de skip ws/comments)
stmt_line = cur_line;
stmt_has_content = true;
// procesar el caracter actual abajo (no es comentario ni ws)
if (c == '\'') m = Mode::SingleStr;
else if (c == '"') m = Mode::DoubleStr;
else if (c == '`') m = Mode::BackTick;
else if (c == ';') {
flush(i);
stmt_start = i + 1;
stmt_has_content = false;
}
} else if (c == '\'') {
m = Mode::SingleStr;
} else if (c == '"') {